forked from runtipi/runtipi
-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (140 loc) · 4.7 KB
/
beta-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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Beta Release
on:
workflow_dispatch:
inputs:
tag:
description: "Beta version tag (1, 2, 3, ...)"
required: true
jobs:
create-tag:
runs-on: ubuntu-latest
outputs:
tagname: ${{ steps.get_tag.outputs.tagname }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get tag from package.json
id: get_tag
run: |
VERSION=$(npm run version --silent)
echo "tagname=v${VERSION}-beta.${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
build-images:
needs: create-tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "runtipi/runtipi-cloud-builder"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images
uses: docker/build-push-action@v6
with:
build-args: |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
TIPI_VERSION=${{ needs.create-tag.outputs.tagname }}
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.create-tag.outputs.tagname }}
build-cli:
runs-on: ubuntu-latest
needs: create-tag
steps:
- name: Dispatch an action and get the run ID
uses: codex-/return-dispatch@v2
id: return_dispatch
with:
token: ${{ secrets.PAT_CLI }}
ref: main
repo: cli
owner: runtipi
workflow: build.yml
workflow_inputs: '{ "version": "${{ needs.create-tag.outputs.tagname }}" }'
- name: Await Run ID ${{ steps.return_dispatch.outputs.run_id }}
uses: Codex-/[email protected]
with:
token: ${{ secrets.PAT_CLI }}
repo: cli
owner: runtipi
run_id: ${{ steps.return_dispatch.outputs.run_id }}
run_timeout_seconds: 1200
poll_interval_ms: 5000
- name: Create bin folder
run: mkdir -p bin
- name: Download CLI form release on runtipi/cli repo
run: |
REPO="runtipi/cli"
VERSION="${{ needs.create-tag.outputs.tagname }}"
ASSETS_URL=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$REPO/releases/tags/$VERSION" \
| jq -r '.assets[] | select(.name | test("runtipi-cli.+")) | .browser_download_url')
echo "Assets URL: $ASSETS_URL"
for url in $ASSETS_URL; do
echo "Downloading from $url"
curl -L -o "bin/${url##*/}" -H "Accept: application/octet-stream" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$url"
done
- name: Upload CLI
uses: actions/upload-artifact@v4
with:
name: cli
path: bin
build-pi-image:
runs-on: ubuntu-latest
needs: create-tag
steps:
- name: Dispatch the release action
uses: codex-/return-dispatch@v2
with:
token: ${{ secrets.PAT_CLI }}
ref: main
repo: raspberrypi
owner: runtipi
workflow: beta-release.yml
workflow_inputs: '{ "version": "${{ needs.create-tag.outputs.tagname }}" }'
publish-release:
runs-on: ubuntu-latest
needs: [create-tag, build-images, build-cli]
outputs:
id: ${{ steps.create_release.outputs.id }}
steps:
- name: Download CLI
uses: actions/download-artifact@v4
with:
name: cli
path: cli
- name: Create beta release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
**${{ needs.create-tag.outputs.tagname }}**
tag_name: ${{ needs.create-tag.outputs.tagname }}
name: ${{ needs.create-tag.outputs.tagname }}
draft: false
prerelease: true
files: cli/runtipi-cli-*
e2e-tests:
needs: [create-tag, publish-release]
uses: "./.github/workflows/e2e.yml"
secrets: inherit
with:
version: ${{ needs.create-tag.outputs.tagname }}