-
Notifications
You must be signed in to change notification settings - Fork 145
126 lines (104 loc) · 3.77 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-24.04
strategy:
matrix:
node: [20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node + 2 }}
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: sudo npm i -g pkg
- run: pnpm install --frozen-lockfile
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set up QEMU
run: |
sudo apt update
sudo apt install --reinstall -y qemu-user-static
- name: Install ldid
run: |
sudo wget https://github.com/jesec/ldid-static/releases/download/v2.1.4/ldid-amd64 -O /usr/local/bin/ldid
sudo chmod +x /usr/local/bin/ldid
- run: npm run build-pkg
- run: git fetch origin ${{ github.ref }}
- run: git for-each-ref ${{ github.ref }} --format="%(contents)" > body
- name: Rename linuxstatic to linux
run: |
mv dist-pkg/flood-linuxstatic-x64 dist-pkg/flood-linux-x64
mv dist-pkg/flood-linuxstatic-arm64 dist-pkg/flood-linux-arm64
- name: Get the version
id: get_version
run: echo VERSION=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ steps.get_version.outputs.VERSION }}
body_path: body
files: |
dist-pkg/flood-linux-x64
dist-pkg/flood-linux-arm64
dist-pkg/flood-macos-x64
dist-pkg/flood-macos-arm64
dist-pkg/flood-win-x64.exe
dist-pkg/flood-win-arm64.exe
release-docker:
needs: release
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Parse semantic version
id: parse_semver
run: |
full_version=`echo ${GITHUB_REF/refs\/tags\/v/}`
major_version=`echo $full_version | cut -d'.' -f1`
minor_version=`echo $full_version | cut -d'.' -f2`
major_minor=`echo $major_version.$minor_version`
echo MAJOR_VERSION=$major_version >> $GITHUB_OUTPUT
echo MAJOR_MINOR=$major_minor >> $GITHUB_OUTPUT
echo FULL_VERSION=$full_version >> $GITHUB_OUTPUT
- name: Set up QEMU
run: |
sudo apt update
sudo apt install --reinstall -y qemu-user-static
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Wait until the package is available
uses: nick-invision/retry@v3
with:
command: curl -f -s https://registry.npmjs.org/flood/${{ steps.parse_semver.outputs.FULL_VERSION }} &>/dev/null
timeout_minutes: 30
max_attempts: 15
retry_wait_seconds: 15
- run: sleep 120
- name: Publish to Docker Hub
uses: docker/build-push-action@v5
with:
build-args: VERSION=${{ steps.parse_semver.outputs.FULL_VERSION }}
context: .
file: ./distribution/containers/Dockerfile.release
platforms: linux/amd64,linux/arm64
push: true
tags: |
jesec/flood:latest
jesec/flood:${{ steps.parse_semver.outputs.MAJOR_VERSION }}
jesec/flood:${{ steps.parse_semver.outputs.MAJOR_MINOR }}
jesec/flood:${{ steps.parse_semver.outputs.FULL_VERSION }}