-
-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (117 loc) · 3.56 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build for release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if version matches
run: |
VERSION=$(cat VERSION)
if [[ -z "$VERSION" ]]; then
echo "empty VERSION"
exit 1
fi
if [[ "$GIT_TAG" != "$VERSION"* ]]; then
echo "VERSION=${VERSION} but GIT_TAG=${GIT_TAG}"
exit 1
fi
echo -n "${GIT_TAG}" > VERSION
env:
GIT_TAG: ${{ github.ref_name }}
- name: Metadata
id: metadata
run: |
BUILD_NUM=$(date -u +%Y%m%d%H%M%S)
echo "BUILD_NUM=$BUILD_NUM (env)"
echo "BUILD_NUM=$BUILD_NUM" >> "$GITHUB_ENV"
COMMIT_HASH=$(git rev-parse --short HEAD)
echo "COMMIT_HASH=$COMMIT_HASH (env)"
echo "COMMIT_HASH=$COMMIT_HASH" >> ${GITHUB_ENV}
PRERELEASE=false
echo "${GITHUB_REF_NAME}" | grep -q - && PRERELEASE=true
echo "PRERELEASE=${PRERELEASE} (output)"
echo "PRERELEASE=${PRERELEASE}" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install npm dependencies
run: |
cd web
npm install
- name: Build frontend
run: |
export REACT_APP_CONTAINERUP_VERSION=$(cat VERSION)
export REACT_APP_CONTAINERUP_BUILD=${BUILD_NUM}
export REACT_APP_CONTAINERUP_COMMIT=${COMMIT_HASH}
export GENERATE_SOURCEMAP=false
cd web
npm run build
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '^1.19.0'
check-latest: true
- name: Build project for linux-amd64
run: ./build.sh
env:
GOARCH: amd64
GOOS: linux
- name: Build project for linux-arm64
run: ./build.sh
env:
GOARCH: arm64
GOOS: linux
- name: Build project for linux-arm
run: ./build.sh
env:
GOARCH: arm
GOOS: linux
- name: Release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
draft: true
prerelease: ${{ steps.metadata.PRERELEASE }}
files: |
containerup_linux_amd64
containerup_linux_arm64
containerup_linux_arm
- name: Build containers
uses: ContainerUp/podman-in-podman-build@v1
with:
podman-image: quay.io/containers/podman:v4.6
platforms: |
linux/amd64
linux/arm64
linux/arm
repository: containerup
tags: |
latest
${{ github.ref_name }}
- name: Push to quay.io
uses: redhat-actions/push-to-registry@v2
with:
image: containerup
tags: ${{ github.ref_name }}
registry: quay.io/containerup
username: containerup+github
password: ${{ secrets.QUAY_IO_PASSWORD }}
- name: Push to quay.io (latest)
if: ${{ steps.metadata.PRERELEASE == 'false' }}
uses: redhat-actions/push-to-registry@v2
with:
image: containerup
tags: latest
registry: quay.io/containerup
username: containerup+github
password: ${{ secrets.QUAY_IO_PASSWORD }}