mirror of
				https://github.com/factoriotools/factorio-docker.git
				synced 2025-10-31 00:48:07 +01:00 
			
		
		
		
	Converto to GitHub actions (#364)
This commit is contained in:
		
							
								
								
									
										15
									
								
								.github/workflows/docker-description.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.github/workflows/docker-description.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| name: Docker build & push | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: master | ||||
|  | ||||
| jobs: | ||||
|   docker-description: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: description  | ||||
|         run: | | ||||
|           DOCKERHUB_USERNAME=$DOCKER_USERNAME DOCKERHUB_PASSWORD=$DOCKER_PASSWORD DOCKERHUB_REPOSITORY='factoriotools/factorio' README_FILEPATH='./README.md' ./update-dockerhub-description.sh | ||||
							
								
								
									
										45
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| name: Docker build & push | ||||
|  | ||||
| on: | ||||
|   pull_request: | ||||
|   push: | ||||
|     branches: master | ||||
|  | ||||
| jobs: | ||||
|   old-version: | ||||
|     runs-on: ubuntu-latest | ||||
|     strategy: | ||||
|       matrix: | ||||
|         version: [ 0.18, 0.17, 0.16, 0.15, 0.14 ] | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: build  | ||||
|         env: | ||||
|           VERSION_SHORT: ${{ matrix.version }} | ||||
|         run: | | ||||
|           ./build.sh ${{ matrix.version }} | ||||
|            | ||||
|   stable: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: build  | ||||
|         env: | ||||
|           EXTRA_TAG: stable | ||||
|           VERSION_SHORT: 1.0 | ||||
|         run: | | ||||
|           ./build.sh $VERSION_SHORT | ||||
|  | ||||
|   experimental: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: build  | ||||
|         env: | ||||
|           EXTRA_TAG: latest | ||||
|           VERSION_SHORT: 1.1 | ||||
|         run: | | ||||
|           ./build.sh $VERSION_SHORT | ||||
							
								
								
									
										27
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/lint.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| name: 'Linter' | ||||
|  | ||||
| on: | ||||
|   pull_request: | ||||
|   push: | ||||
|     branches: master | ||||
|  | ||||
| jobs: | ||||
|   shellcheck: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - name: shellcheck | ||||
|         uses: reviewdog/action-shellcheck@v1 | ||||
|         with: | ||||
|           github_token: ${{ secrets.github_token }} | ||||
|           reporter: github-pr-review | ||||
|  | ||||
|   hadolint: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - name: hadolint | ||||
|         uses: reviewdog/action-hadolint@v1 | ||||
|         with: | ||||
|           github_token: ${{ secrets.github_token }} | ||||
|           reporter: github-pr-review | ||||
							
								
								
									
										40
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,40 +0,0 @@ | ||||
| dist: xenial | ||||
| language: bash | ||||
| services: | ||||
|   - docker | ||||
|  | ||||
| addons: | ||||
|   apt: | ||||
|     packages: | ||||
|     - jq | ||||
|  | ||||
| jobs: | ||||
|   include: | ||||
|     - stage: test | ||||
|       script: | ||||
|         # Travis gets rate limited by Docker HUB. | ||||
|         - | | ||||
|           [[ -n $DOCKER_PASSWORD && -n $DOCKER_USERNAME ]] && echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||||
|         - git ls-files --exclude='*Dockerfile' --ignored | xargs --max-lines=1 -I{} sh -c 'docker run --rm -i -v ${PWD}/.hadolint.yaml:/.hadolint.yaml hadolint/hadolint < "$1"' -- {} | ||||
|         - bash -c 'shopt -s globstar; shellcheck **/*.sh' | ||||
|  | ||||
|     - &build | ||||
|       stage: Build & update Docker HUB description | ||||
|       env: VERSION_SHORT=1.1 EXTRA_TAG=latest | ||||
|       script: | ||||
|         - ./build.sh $VERSION_SHORT | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=1.0 EXTRA_TAG=stable | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.18 | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.17 | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.16 | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.15 | ||||
|     - <<: *build | ||||
|       env: VERSION_SHORT=0.14 | ||||
|     - <<: *build | ||||
|       if: branch = master AND type != pull_request | ||||
|       script: DOCKERHUB_USERNAME=$DOCKER_USERNAME DOCKERHUB_PASSWORD=$DOCKER_PASSWORD DOCKERHUB_REPOSITORY='factoriotools/factorio' README_FILEPATH='./README.md' ./update-dockerhub-description.sh | ||||
							
								
								
									
										32
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								build.sh
									
									
									
									
									
								
							| @@ -16,19 +16,21 @@ cd "$VERSION_SHORT" || exit 1 | ||||
| VERSION=$(grep -oP '[0-9]+\.[0-9]+\.[0-9]+' Dockerfile | head -1) | ||||
| DOCKER_REPO=factoriotools/factorio | ||||
|  | ||||
| if [[ ${TRAVIS_PULL_REQUEST:-} == true ]]; then | ||||
|   TAGS="$DOCKER_REPO:$TRAVIS_PULL_REQUEST_SLUG" | ||||
| BRANCH=${GITHUB_REF#refs/heads/} | ||||
|  | ||||
| if [[ -n ${GITHUB_BASE_REF:-} ]]; then | ||||
|   TAGS="$DOCKER_REPO:$GITHUB_BASE_REF" | ||||
| else | ||||
|   if [[ -n ${CI:-} ]]; then | ||||
|     # we are either on master or on a tag build | ||||
|     if [[ ${TRAVIS_BRANCH:-} == master || ${TRAVIS_BRANCH:-} == "$VERSION" ]]; then | ||||
|     if [[ ${BRANCH:-} == master || ${BRANCH:-} == "$VERSION" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT" | ||||
|     # we are on an incremental build of a tag | ||||
|     elif [[ $VERSION == "${TRAVIS_BRANCH%-*}" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH -t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT" | ||||
|     elif [[ $VERSION == "${BRANCH%-*}" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$BRANCH -t $DOCKER_REPO:$VERSION -t $DOCKER_REPO:$VERSION_SHORT" | ||||
|     # we build a other branch than master and exclude dependabot branches from tags cause the / is not supported by docker | ||||
|     elif [[ -n ${TRAVIS_BRANCH:-} && ! $TRAVIS_BRANCH =~ "/" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$TRAVIS_BRANCH" | ||||
|     elif [[ -n ${BRANCH:-} && ! $BRANCH =~ "/" ]]; then | ||||
|       TAGS="-t $DOCKER_REPO:$BRANCH" | ||||
|     fi | ||||
|   else | ||||
|     # we are not in CI and tag version and version short | ||||
| @@ -58,13 +60,13 @@ docker images | ||||
|  | ||||
| # remove -1 from incremental tag | ||||
| # eg before: 0.18.24-1, after 0.18.24 | ||||
| if [[ ${TRAVIS_BRANCH:-} ]]; then | ||||
|   TRAVIS_BRANCH_VERSION=${TRAVIS_BRANCH%-*} | ||||
| if [[ ${BRANCH:-} ]]; then | ||||
|   BRANCH_VERSION=${BRANCH%-*} | ||||
| fi | ||||
|  | ||||
| # only push when: | ||||
| # or we build a tag and we don't build a PR | ||||
| if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" && ${TRAVIS_PULL_REQUEST_BRANCH:-} == "" ]] || | ||||
| if [[ $VERSION == "${BRANCH_VERSION:-}" && ${GITHUB_BASE_REF:-} == "" ]] || | ||||
|   # or we are not in CI | ||||
|   [[ -z ${CI:-} ]]; then | ||||
|  | ||||
| @@ -73,18 +75,18 @@ if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" && ${TRAVIS_PULL_REQUEST_BRANCH:- | ||||
|   fi | ||||
|  | ||||
|   # push a tag on a branch other than master except dependabot branches cause docker does not support / | ||||
|   if [[ -n ${TRAVIS_BRANCH:-} && $VERSION != "${TRAVIS_BRANCH_VERSION:-}" && ${TRAVIS_BRANCH:-} != "master" && ! ${TRAVIS_BRANCH:-} =~ "/" ]]; then | ||||
|     docker push "$DOCKER_REPO:$TRAVIS_BRANCH" | ||||
|   if [[ -n ${BRANCH:-} && $VERSION != "${BRANCH_VERSION:-}" && ${BRANCH:-} != "master" && ! ${BRANCH:-} =~ "/" ]]; then | ||||
|     docker push "$DOCKER_REPO:$BRANCH" | ||||
|   fi | ||||
|  | ||||
|   # push an incremental tag | ||||
|   # eg 0.18.24-1 | ||||
|   if [[ $VERSION == "${TRAVIS_BRANCH_VERSION:-}" ]]; then | ||||
|     docker push "$DOCKER_REPO:$TRAVIS_BRANCH" | ||||
|   if [[ $VERSION == "${BRANCH_VERSION:-}" ]]; then | ||||
|     docker push "$DOCKER_REPO:$BRANCH" | ||||
|   fi | ||||
|  | ||||
|   # only push on tags or when manually running the script | ||||
|   if [[ -n ${TRAVIS_TAG:-} || -z ${CI:-} ]]; then | ||||
|   if [[ -n ${GITHUB_BASE_REF:-} || -z ${CI:-} ]]; then | ||||
|     docker push "$DOCKER_REPO:$VERSION" | ||||
|     docker push "$DOCKER_REPO:$VERSION_SHORT" | ||||
|   fi | ||||
|   | ||||
		Reference in New Issue
	
	Block a user