This repository has been archived by the owner on Jun 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (52 loc) · 2.36 KB
/
push.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
name: "Update Image in Quay.io"
on:
push:
tags:
- 'release-*'
jobs:
push:
name: Push Job
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: actions/setup-go@v2
with:
go-version: '^1.9'
- name: Install gox
run: go get github.com/mitchellh/gox
- name: Install file
run: sudo apt-get install file
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: release
run: |
tagRE='release-(.*)'
if [[ "${{ env.RELEASE_VERSION }}" =~ ${tagRE} ]]; then
# This will use gox to create the artifacts and the scripts in scripts to do the actual release
# For the is to work, the GH_TOKEN env var needs to be set in the repo config
make upload VERSION=${BASH_REMATCH[1]}
else
echo "${{ env.RELEASE_VERSION }} does NOT match the expected pattern. This is probably a job configuration issue"
exit 1
fi
- name: push image
run: |
tagRE='release-(.*)'
if [[ "${{ env.RELEASE_VERSION }}" =~ ${tagRE} ]]; then
VERSION=${BASH_REMATCH[1]}
docker build -t spring-boot-generator:${VERSION} -f config/Dockerfile_generator --build-arg VERSION=${VERSION} --build-arg GITCOMMIT=$(git rev-parse --short HEAD 2>/dev/null) .
TAG_ID=$(docker images -q spring-boot-generator:${VERSION})
docker tag ${TAG_ID} quay.io/snowdrop/spring-boot-generator:${VERSION}
docker tag ${TAG_ID} quay.io/snowdrop/spring-boot-generator:latest
docker login quay.io -u="${{secrets.QUAY_USER}}" -p="${{secrets.QUAY_TOKEN}}"
docker push quay.io/snowdrop/spring-boot-generator:${VERSION}
docker push quay.io/snowdrop/spring-boot-generator:latest
# Remove the trigger tag
scripts/delete_release_manually.sh "${{secrets.GH_TOKEN}" "${{ env.RELEASE_VERSION }}"
# Add the commits that correspond to the tag to the description of the GitHub reelase
scripts/update_release_change_log.sh "${GITHUB_API_TOKEN}" "v${VERSION}"
else
echo "${{ env.RELEASE_VERSION }} does NOT match the expected pattern. This is probably a job configuration issue"
exit 1
fi