Update build.yml

This commit is contained in:
Kroese 2023-04-19 01:07:53 +02:00 committed by GitHub
parent 114522fd82
commit 09e2e798a2

View File

@ -11,18 +11,34 @@ on:
- '.github/workflows/**' - '.github/workflows/**'
jobs: jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2001 -e SC2002 -e SC2116 -e SC2034 -e SC1091 -e SC2143 -e SC2223 -e SC2086 -e SC2145 -e SC2015 -e SC2268 -e SC2207 -e SC2064 -e SC2162 -e SC2166
build: build:
needs: shellcheck
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
packages: write packages: write
contents: read contents: read
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
fetch-depth: 0
- -
name: Build the Docker image name: Build the Docker image
run: docker build . --file Dockerfile --build-arg "VERSION_ARG=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --build-arg "BUILD_ARG=${GITHUB_RUN_ID}" --label "id=${GITHUB_RUN_ID}" --label "version=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --tag "${{ github.repository }}:latest" --tag "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --tag "ghcr.io/${{ github.repository }}:latest" --tag "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" run: docker build . --file Dockerfile --build-arg "VERSION_ARG=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --build-arg "BUILD_ARG=${GITHUB_RUN_ID}" --label "id=${GITHUB_RUN_ID}" --label "version=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --tag "${{ github.repository }}:latest" --tag "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" --tag "ghcr.io/${{ github.repository }}:latest" --tag "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}"
-
name: Update Minor version
uses: hmanzur/actions-set-secret@v2.0.0
with:
name: 'MINOR'
value: $((${{ secrets.MINOR }}+1))
repository: ${{ github.repository }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- -
name: Login to Docker Hub name: Login to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
@ -42,14 +58,14 @@ jobs:
- -
name: Push to Github Container Registry name: Push to Github Container Registry
run: docker push "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && docker push "ghcr.io/${{ github.repository }}:latest" run: docker push "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && docker push "ghcr.io/${{ github.repository }}:latest"
- mirror:
name: Update Minor version runs-on: ubuntu-latest
uses: hmanzur/actions-set-secret@v2.0.0 permissions:
contents: read
steps:
- uses: actions/checkout@v3
with: with:
name: 'MINOR' fetch-depth: 0
value: $((${{ secrets.MINOR }}+1))
repository: ${{ github.repository }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- -
name: Push to Gitlab mirror name: Push to Gitlab mirror
uses: wangchucheng/git-repo-sync@v0.1.0 uses: wangchucheng/git-repo-sync@v0.1.0