110 lines
3.2 KiB
YAML
Raw Normal View History

2023-03-28 18:57:22 +02:00
name: Build
on:
push:
2023-04-27 23:40:28 +02:00
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-30 07:09:25 +02:00
name: Check
2023-04-19 01:32:32 +02:00
uses: ./.github/workflows/check.yml
2023-03-28 18:57:22 +02:00
build:
2023-04-30 07:09:25 +02:00
name: 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 \
2023-04-30 21:58:19 +02:00
--build-arg "VERSION_ARG=${{ vars.MAJOR }}.${{ vars.MINOR }}" \
2023-04-21 06:12:36 +02:00
--build-arg "BUILD_ARG=${GITHUB_RUN_ID}" \
--build-arg "DATE_ARG=${{ github.event.repository.updated_at }}" \
--label "build=${GITHUB_RUN_ID}" \
2023-04-30 21:58:19 +02:00
--label "version=${{ vars.MAJOR }}.${{ vars.MINOR }}" \
2023-04-21 06:12:36 +02:00
--tag "${{ github.repository }}:latest" \
2023-04-30 21:58:19 +02:00
--tag "${{ github.repository }}:${{ vars.MAJOR }}.${{ vars.MINOR }}" \
2023-04-21 06:12:36 +02:00
--tag "ghcr.io/${{ github.repository }}:latest" \
2023-04-30 21:58:19 +02:00
--tag "ghcr.io/${{ github.repository }}:${{ vars.MAJOR }}.${{ vars.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-21 06:12:36 +02:00
run: |
2023-04-30 21:58:19 +02:00
docker push "${{ github.repository }}:${{ vars.MAJOR }}.${{ vars.MINOR }}" &&\
2023-04-21 06:12:36 +02:00
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: |
2023-04-30 21:58:19 +02:00
docker push "ghcr.io/${{ github.repository }}:${{ vars.MAJOR }}.${{ vars.MINOR }}" && \
2023-04-21 06:12:36 +02:00
docker push "ghcr.io/${{ github.repository }}:latest"
2023-04-27 23:40:28 +02:00
2023-04-29 08:33:23 +02:00
release:
2023-04-27 23:40:28 +02:00
needs: build
2023-04-30 22:01:39 +02:00
name: Release
2023-04-27 23:40:28 +02:00
runs-on: ubuntu-latest
2023-04-29 08:33:23 +02:00
permissions:
contents: write
2023-04-28 01:03:00 +02:00
steps:
2023-04-29 08:33:23 +02:00
- uses: actions/checkout@v3
-
name: Create a release
uses: kroese/github-release@v5
2023-04-29 08:33:23 +02:00
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
with:
2023-04-30 21:58:19 +02:00
tag: "v${{ vars.MAJOR }}.${{ vars.MINOR }}"
title: "v${{ vars.MAJOR }}.${{ vars.MINOR }}"
body: "Release v${{ vars.MAJOR }}.${{ vars.MINOR }}"
2023-04-29 08:33:23 +02:00
-
name: Increment minor version
run: |
2023-04-30 21:58:19 +02:00
echo "NEW_MINOR=$((${{ vars.MINOR }}+1))" >> $GITHUB_ENV
2023-04-30 13:34:57 +02:00
-
name: Update minor version variable
2023-04-30 21:58:19 +02:00
uses: kroese/set-variable@v3
2023-04-30 13:34:57 +02:00
with:
name: 'MINOR'
value: ${{ env.NEW_MINOR }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
2023-04-19 01:07:53 +02:00
mirror:
2023-04-30 07:09:25 +02:00
name: Mirror
2023-04-19 01:07:53 +02:00
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 }}