arv-v-dsm/.github/workflows/build.yml
2023-04-19 01:32:32 +02:00

69 lines
2.3 KiB
YAML

name: Build
on:
push:
branches: [ master ]
paths-ignore:
- '**/*.md'
- '.gitignore'
- '.dockerignore'
- '.github/**'
- '.github/workflows/**'
jobs:
check:
uses: ./.github/workflows/check.yml
build:
needs: check
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
-
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 }}"
-
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
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Push to DockerHub
run: docker push "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && docker push "${{ github.repository }}:latest"
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Push to Github Container Registry
run: docker push "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && docker push "ghcr.io/${{ github.repository }}:latest"
mirror:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Push to Gitlab mirror
uses: wangchucheng/git-repo-sync@v0.1.0
with:
target-url: ${{ secrets.GITLAB_URL }}
target-username: ${{ secrets.GITLAB_USERNAME }}
target-token: ${{ secrets.GITLAB_TOKEN }}