-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (109 loc) · 3.73 KB
/
cut-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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
name: Release
on:
push:
tags:
- v3.*
jobs:
release-archive:
name: Create Release Archive
runs-on: 'ubuntu-latest'
steps:
- name: Setup
run: |
tag=`basename ${{ github.ref }}`
echo "PREFIX=quay-${tag}/" >> $GITHUB_ENV
echo "TAG=${tag}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Release Archive
# any additional files can be added by appending to the tar
# created by `git archive`. For example:
#
# tar -rf release.tar --transform "s,^,${PREFIX}," vendor
run: |
git archive --prefix "${PREFIX}" -o release.tar "${GITHUB_REF}"
gzip release.tar
- name: ChangeLog
shell: bash
run: |
curl -o /tmp/git-chglog.tar.gz -fsSL\
https://github.com/git-chglog/git-chglog/releases/download/v0.14.0/git-chglog_0.14.0_linux_amd64.tar.gz
tar xvf /tmp/git-chglog.tar.gz --directory /tmp
chmod u+x /tmp/git-chglog
echo "creating change log for tag: $TAG"
/tmp/git-chglog --tag-filter-pattern "v3.*" -o changelog v3.6.0-alpha.4..
- name: Upload Release Archive
uses: actions/upload-artifact@v4
with:
name: release
path: |
release.tar.gz
changelog
if-no-files-found: error
release:
name: Release
runs-on: 'ubuntu-latest'
permissions:
contents: write
if: github.event_name == 'push'
needs: [release-archive]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Setup
run: |
tag=`basename ${{ github.ref }}`
echo "VERSION=${tag}" >> $GITHUB_ENV
- name: Fetch Artifacts
uses: actions/download-artifact@v4
id: download
with:
name: release
- name: Create Release
uses: ncipollo/release-action@v1.11.1
id: create_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
bodyFile: ${{steps.download.outputs.download-path}}/changelog
tag: ${{ github.ref }}
name: ${{ env.VERSION }} Release
prerelease: ${{ contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') || contains(env.VERSION, 'rc') }}
- name: Publish Release Archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{steps.download.outputs.download-path}}/release.tar.gz
asset_name: quay-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip
publish-container:
name: Publish Container
runs-on: 'ubuntu-latest'
needs: [release-archive, release]
steps:
- name: Setup
run: |
tag=`basename ${{ github.ref }}`
echo "QUAY_VERSION=${tag}" >> $GITHUB_ENV
echo "TAG=quay.io/projectquay/quay:${tag}" >> $GITHUB_ENV
echo "QUAY_USER=projectquay+quay_github" >> $GITHUB_ENV
echo "::add-mask::${{ secrets.QUAY_TOKEN }}"
- name: Fetch Artifacts
uses: actions/download-artifact@v4
id: download
with:
name: release
- name: Build Release Container
run: |
d=$(mktemp -d)
trap 'rm -rf "$d"' EXIT
tar -xz -f ${{steps.download.outputs.download-path}}/release.tar.gz --strip-components=1 -C "$d"
docker build --build-arg QUAY_VERSION --tag "${TAG}" "$d"
- name: Publish Release Container
run: |
docker login -u "${QUAY_USER}" -p '${{ secrets.QUAY_TOKEN }}' quay.io
docker push "${TAG}"