-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (54 loc) · 1.85 KB
/
release.yml
File metadata and controls
68 lines (54 loc) · 1.85 KB
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
name: Release
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Build
run: |
npm install
npm run build
- name: Set current date as env variable
run: echo "NOW=$(date -u +'%Y-%m-%d %H:%M:%S') UTC" >> $GITHUB_ENV
- name: Set current path friendly date as env variable
run: echo "NOW_PATH=$(date -u +'%Y-%m-%dT%H%M%SZ')" >> $GITHUB_ENV
- name: Set commit short sha as env variable
run: echo "SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Set release archive name as env variable
run: echo "ARCHIVE_NAME=${GITHUB_REPOSITORY#*/}_${NOW_PATH}_${SHORT_SHA}.zip" >> $GITHUB_ENV
- name: Package
run: |
mkdir proxy_stuff
cp -r config dist py img LICENSE manifest.yml README.md proxy_stuff
zip -r "./${ARCHIVE_NAME}" proxy_stuff
- name: Create release tag
run: |
git tag -f ${NOW_PATH}
git push origin ${NOW_PATH}
- name: Release
uses: softprops/action-gh-release@v2
with:
name: "${{ env.NOW }} ${{ env.SHORT_SHA }}"
files: ${{ env.ARCHIVE_NAME }}
tag_name: ${{ env.NOW_PATH }}
fail_on_unmatched_files: true
generate_release_notes: true
- name: Delete old releases
run: gh release list --json tagName --jq '.[] | .tagName' | tail -n+7 | xargs -r -n 1 gh release delete --yes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}