Update alpine Docker tag to v3.21.2 #199
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lint-build-push | |
on: | |
push: | |
tags-ignore: | |
- "**" | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- master | |
release: | |
types: [published] | |
env: | |
IMAGE_NAME: bgauduch/cod2server | |
IMAGE_TAG: latest | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Lint Dockerfile | |
uses: brpaz/hadolint-action@master | |
with: | |
dockerfile: "Dockerfile" | |
build: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Overidde image tag with branch name if not on master | |
if: contains(github.ref, 'master') != true | |
run: echo "IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: Build image | |
run: docker image build . --file Dockerfile --build-arg COD2_VERSION="1_3" --build-arg COD2_LNXDED_TYPE="_nodelay_va_loc" --tag $IMAGE_NAME:$IMAGE_TAG | |
- name: save image | |
run: docker image save -o image-$IMAGE_TAG.tar $IMAGE_NAME:$IMAGE_TAG | |
- name: Upload image artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: image-${{ env.IMAGE_TAG }} | |
path: image-${{ env.IMAGE_TAG }}.tar | |
push: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Overidde image tag with branch name if not on master | |
if: contains(github.ref, 'master') != true | |
run: echo "IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
- name: download image artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: image-${{ env.IMAGE_TAG }} | |
- name: load image | |
run: docker image load --input image-$IMAGE_TAG.tar | |
- name: Login to Docker Hub registry | |
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
- name: Push image to registry | |
run: docker push $IMAGE_NAME:$IMAGE_TAG | |
build_all: | |
if: contains(github.ref, 'master') || github.event.release | |
runs-on: ubuntu-latest | |
needs: lint | |
strategy: | |
matrix: | |
versions: | |
- { cod2_version: "1_0", cod2_lnxded_type: "a" } | |
- { cod2_version: "1_0", cod2_lnxded_type: "a_va" } | |
- { cod2_version: "1_0", cod2_lnxded_type: "a_va_loc" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c_nodelay" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c_nodelay_va_loc" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c_patch_va_loc" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_cracked" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_nodelay" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_patch_va_loc" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_nodelay_va_loc" } | |
env: | |
COD2_VERSION: ${{ matrix.versions.cod2_version }} | |
COD2_LNXDED_TYPE: ${{ matrix.versions.cod2_lnxded_type }} | |
IMAGE_TAG: ${{ matrix.versions.cod2_version }}${{ matrix.versions.cod2_lnxded_type }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Build image | |
run: docker image build . --file Dockerfile --build-arg COD2_VERSION=$COD2_VERSION --build-arg COD2_LNXDED_TYPE=$COD2_LNXDED_TYPE --tag $IMAGE_NAME:$IMAGE_TAG | |
- name: save image | |
run: docker image save -o image-$IMAGE_TAG.tar $IMAGE_NAME:$IMAGE_TAG | |
- name: Upload image artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: image-${{ env.IMAGE_TAG }} | |
path: image-${{ env.IMAGE_TAG }}.tar | |
push_all: | |
if: github.event.release | |
runs-on: ubuntu-latest | |
needs: build_all | |
strategy: | |
matrix: | |
versions: | |
- { cod2_version: "1_0", cod2_lnxded_type: "a" } | |
- { cod2_version: "1_0", cod2_lnxded_type: "a_va" } | |
- { cod2_version: "1_0", cod2_lnxded_type: "a_va_loc" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c_nodelay" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c_nodelay_va_loc" } | |
- { cod2_version: "1_2", cod2_lnxded_type: "c_patch_va_loc" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_cracked" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_nodelay" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_patch_va_loc" } | |
- { cod2_version: "1_3", cod2_lnxded_type: "_nodelay_va_loc" } | |
env: | |
IMAGE_TAG: ${{ matrix.versions.cod2_version }}${{ matrix.versions.cod2_lnxded_type }} | |
steps: | |
- name: download image artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: image-${{ env.IMAGE_TAG }} | |
- name: load image | |
run: docker image load --input image-$IMAGE_TAG.tar | |
- name: Login to Docker Hub registry | |
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
- name: Push image to registry | |
run: docker push $IMAGE_NAME:$IMAGE_TAG |