58 lines
2.0 KiB
YAML
Raw Normal View History

2023-03-28 18:57:22 +02:00
name: Build
on:
push:
branches: [ master ]
2023-04-03 00:36:30 +02:00
paths-ignore:
2023-04-03 14:08:07 +02:00
- '**/*.md'
- '**/*.yml'
2023-04-16 05:55:23 +02:00
- '**/logo.jpg'
2023-03-28 18:57:22 +02:00
jobs:
build:
runs-on: ubuntu-latest
2023-04-03 23:37:33 +02:00
permissions:
packages: write
contents: read
steps:
2023-03-28 18:57:22 +02:00
- uses: actions/checkout@v3
2023-04-16 02:29:03 +02:00
with:
fetch-depth: 0
2023-03-28 18:57:22 +02:00
-
name: Build the Docker image
2023-04-04 00:01:10 +02:00
run: docker build . --file Dockerfile --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 }}"
2023-03-28 18:57:22 +02:00
-
2023-03-28 19:05:21 +02:00
name: Login to Docker Hub
uses: docker/login-action@v2
2023-03-28 18:57:22 +02:00
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Push to DockerHub
2023-04-03 23:37:33 +02:00
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
2023-04-03 23:45:38 +02:00
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
2023-04-03 23:37:33 +02:00
-
2023-04-16 02:29:03 +02:00
name: Push to Github Container Registry
2023-04-03 23:37:33 +02:00
run: docker push "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && docker push "ghcr.io/${{ github.repository }}:latest"
2023-03-28 18:57:22 +02:00
-
name: Update Minor version
uses: hmanzur/actions-set-secret@v2.0.0
with:
name: 'MINOR'
value: $((${{ secrets.MINOR }}+1))
2023-04-03 23:37:33 +02:00
repository: ${{ github.repository }}
2023-04-10 00:36:24 +02:00
token: ${{ secrets.REPO_ACCESS_TOKEN }}
2023-04-16 02:01:32 +02:00
-
2023-04-16 02:29:03 +02:00
name: Push to Gitlab mirror
2023-04-16 02:02:07 +02:00
uses: wangchucheng/git-repo-sync@v0.1.0
with:
2023-04-16 05:52:28 +02:00
target-url: ${{ secrets.GITLAB_URL }}
target-username: ${{ secrets.GITLAB_USERNAME }}
2023-04-16 02:02:07 +02:00
target-token: ${{ secrets.GITLAB_TOKEN }}