2023-03-28 18:57:22 +02:00
|
|
|
name: Build
|
|
|
|
|
|
|
|
on:
|
2023-05-11 01:28:41 +02:00
|
|
|
workflow_dispatch:
|
2023-03-28 18:57:22 +02:00
|
|
|
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-05-12 13:55:02 +02:00
|
|
|
- '**/*.yml'
|
2023-04-16 06:29:19 +02:00
|
|
|
- '.gitignore'
|
|
|
|
- '.dockerignore'
|
2023-04-16 05:59:29 +02:00
|
|
|
- '.github/**'
|
|
|
|
- '.github/workflows/**'
|
2023-05-12 13:29:54 +02:00
|
|
|
- 'Dockerfile'
|
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 \
|
|
|
|
--build-arg "BUILD_ARG=${GITHUB_RUN_ID}" \
|
2023-05-20 03:14:38 +02:00
|
|
|
--build-arg "VERSION_ARG=${{ vars.MAJOR }}.${{ vars.MINOR }}" \
|
2023-04-21 06:12:36 +02:00
|
|
|
--build-arg "DATE_ARG=${{ github.event.repository.updated_at }}" \
|
|
|
|
--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
|
2023-05-23 22:51:25 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
-
|
|
|
|
name: Get previous tag
|
|
|
|
id: previousTag
|
|
|
|
run: |
|
|
|
|
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
|
|
|
|
echo "previousTag: $name"
|
|
|
|
echo "previousTag=$name" >> $GITHUB_ENV
|
|
|
|
-
|
|
|
|
name: Generate changelog
|
|
|
|
id: changelog
|
|
|
|
uses: requarks/changelog-action@v1
|
|
|
|
with:
|
|
|
|
token: ${{ github.token }}
|
|
|
|
fromTag: ${{ github.ref_name }}
|
|
|
|
toTag: ${{ env.previousTag }}
|
|
|
|
writeToFile: false
|
2023-04-29 08:33:23 +02:00
|
|
|
-
|
|
|
|
name: Create a release
|
2023-05-19 20:27:18 +02:00
|
|
|
uses: action-pack/github-release@v2
|
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 }}"
|
2023-05-23 22:51:25 +02:00
|
|
|
body: "${{ steps.changelog.outputs.changes }}"
|
2023-04-29 08:33:23 +02:00
|
|
|
-
|
2023-05-23 17:46:36 +02:00
|
|
|
name: Increment version variable
|
|
|
|
uses: action-pack/bump@v2
|
2023-04-30 13:34:57 +02:00
|
|
|
with:
|
|
|
|
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-05-07 00:41:03 +00:00
|
|
|
uses: action-pack/gitlab-sync@v3
|
2023-04-16 02:02:07 +02:00
|
|
|
with:
|
2023-05-04 11:34:37 +02:00
|
|
|
url: ${{ secrets.GITLAB_URL }}
|
|
|
|
token: ${{ secrets.GITLAB_TOKEN }}
|
|
|
|
username: ${{ secrets.GITLAB_USERNAME }}
|