-
Notifications
You must be signed in to change notification settings - Fork 4
98 lines (84 loc) · 3.55 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Release Quesma
# Builds Quesma Docker image using specific git tag
# and creates a GitHub release draft
on:
workflow_dispatch:
inputs:
VERSION:
description: 'Version number - needs to be a valid semver, relevant tag should be present in the repository'
required: true
permissions:
contents: write # To be able to create a release via GitHub API
jobs:
build-quesma-docker-image: # based on nightly-docker-build-and-push.yml, but heavily modified
strategy:
matrix:
module: [ "quesma" ]
runs-on: ubuntu-latest
steps:
- name: Validate input - needs to match semver
run: |
echo "Validating input: ${{ github.event.inputs.VERSION }}"
if ! echo "${{ github.event.inputs.VERSION }}" | grep -qE '^([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$'; then
echo "ERROR: VERSION does not conform to SemVer (Semantic Versioning)"
exit 1
fi
shell: bash
- name: Checkout the correct revision
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.VERSION }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
cache-dependency-path: ${{ matrix.module }}/go.sum
go-version: '1.23'
- name: Login to GCR (only for build running on `main` branch)
uses: docker/login-action@v3
with:
registry: europe-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCR_SERVICE_ACCOUNT_PRIVATE_KEY }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}
- name: Set the build date
run: echo QUESMA_BUILD_DATE=$(git --no-pager log -1 --date=format:'%Y-%m-%d' --format="%ad") >> $GITHUB_ENV
- name: Build and export
uses: docker/build-push-action@v6
with:
context: ${{ matrix.module }}/.
tags: |
europe-docker.pkg.dev/metal-figure-407109/quesma-nightly/quesma:${{ github.event.inputs.VERSION }}
europe-docker.pkg.dev/metal-figure-407109/quesma-nightly/quesma:latest
quesma/quesma:${{ github.event.inputs.VERSION }}
quesma/quesma:latest
push: true
build-args: |
QUESMA_BUILD_SHA=${{ github.sha }}
QUESMA_VERSION=${{ github.event.inputs.VERSION }}
QUESMA_BUILD_DATE=${{ env.QUESMA_BUILD_DATE }}
platforms: linux/amd64,linux/arm64
env:
DOCKER_BUILD_SUMMARY: false
- name: Create GitHub release (draft)
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided by GitHub Actions, doesn't exist in repo secrets
with:
tag_name: ${{ github.event.inputs.VERSION }}
release_name: ${{ github.event.inputs.VERSION }}
body: |
### Quesma ${{ github.event.inputs.VERSION }}
Quesma version `${{ github.event.inputs.VERSION }}` has been released! :confetti_ball:
Check it out at https://hub.docker.com/r/quesma/quesma! You can get the Docker image with:
```bash
docker pull quesma/quesma:${{ github.event.inputs.VERSION }}
```
All tags URL: https://hub.docker.com/r/quesma/quesma/tags
draft: true
prerelease: false