-
Notifications
You must be signed in to change notification settings - Fork 34
73 lines (70 loc) · 2.73 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release docker image
on:
push:
branches:
- master
jobs:
check-release:
runs-on: ubuntu-latest
outputs:
is_skip: ${{ steps.compare_docker_registory_and_local_repository_version.outputs.is_skip }}
steps:
- uses: actions/checkout@v4
- name: Compare Docker Registory and Local Repository Version
id: compare_docker_registory_and_local_repository_version
run: |
release_version=$(cat .simplesamlphp_version)
echo "Release version is ${release_version}"
if [[ "$( curl -sfL https://registry.hub.docker.com/v2/repositories/kenchan0130/simplesamlphp/tags | jq --arg version "${release_version}" '.results[] | select(.name == $version)' )" ]]; then
echo "${release_version} is already released."
echo "::set-output name=is_skip::true"
else
echo "::set-output name=is_skip::false"
fi
- name: Show is_skip output
run: |
echo 'is_skip: ${{ steps.compare_docker_registory_and_local_repository_version.outputs.is_skip }}'
release-image-to-github:
name: Release image to GitHub
needs: check-release
if: ${{ needs.check-release.outputs.is_skip == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push to GitHub
run: |
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY_HOST}" -u "${REGISTRY_USERNAME}" --password-stdin
make release
env:
REGISTRY_HOST: ghcr.io
REGISTRY_USERNAME: ${{ github.repository_owner }}
REGISTRY_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
release-image-to-docker-hub:
name: Release image to Docker Hub
needs: check-release
if: ${{ needs.check-release.outputs.is_skip == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push to Docker Hub
run: |
echo "${REGISTRY_TOKEN}" | docker login -u "${REGISTRY_USERNAME}" --password-stdin
make release
env:
REGISTRY_HOST: index.docker.io
REGISTRY_USERNAME: kenchan0130
REGISTRY_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Sync Docker Hub Description
uses: peter-evans/dockerhub-description@v4
env:
DOCKERHUB_USERNAME: kenchan0130
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_REPOSITORY: kenchan0130/simplesamlphp