84 lines
2.6 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'
2023-04-16 06:29:19 +02:00
- '.gitignore'
- '.dockerignore'
2023-04-16 05:59:29 +02:00
- '.github/**'
- '.github/workflows/**'
2023-03-28 18:57:22 +02:00
jobs:
2023-04-21 06:21:07 +02:00
shellcheck:
2023-04-19 01:32:32 +02:00
uses: ./.github/workflows/check.yml
2023-03-28 18:57:22 +02:00
build:
2023-04-21 07:55:32 +02:00
needs: shellcheck
2023-03-28 18:57:22 +02:00
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
-
name: Build the Docker image
2023-04-21 06:12:36 +02:00
run: |
docker build . \
--file Dockerfile \
--build-arg "VERSION_ARG=${{ secrets.MAJOR }}.${{ secrets.MINOR }}" \
--build-arg "BUILD_ARG=${GITHUB_RUN_ID}" \
--build-arg "DATE_ARG=${{ github.event.repository.updated_at }}" \
--label "build=${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-04-19 01:07:53 +02:00
-
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 }}
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-21 06:12:36 +02:00
run: |
docker push "${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" &&\
docker push "${{ github.repository }}:latest"
2023-04-03 23:37:33 +02:00
-
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-21 06:12:36 +02:00
run: |
docker push "ghcr.io/${{ github.repository }}:${{ secrets.MAJOR }}.${{ secrets.MINOR }}" && \
docker push "ghcr.io/${{ github.repository }}:latest"
2023-04-19 01:07:53 +02:00
mirror:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
2023-03-28 18:57:22 +02:00
with:
2023-04-19 01:07:53 +02:00
fetch-depth: 0
-
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 }}
2023-04-16 02:02:07 +02:00
target-token: ${{ secrets.GITLAB_TOKEN }}
2023-04-21 06:12:36 +02:00
target-username: ${{ secrets.GITLAB_USERNAME }}