-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (85 loc) · 2.82 KB
/
ci.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
name: CI
on:
push:
paths:
- '**'
branches:
- '**'
tags:
- '*.*.*'
workflow_dispatch:
env:
ARTIFACT_NAME: astolfo-bot
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Setup Yarn
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
- name: Copy example .dev.vars
run: cp --verbose --archive .dev.vars.example .dev.vars
- name: Generate Cloudflare Workers types
run: yarn types
- name: Build source code
run: yarn build
- name: Deploy to Cloudflare Workers
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: yarn deploy
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: dist
release:
name: Create release
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
permissions:
contents: write
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: dist
- name: Archive artifact
run: |
zip --recurse-paths ${{ env.ARTIFACT_NAME }}.zip dist
tar --verbose --create --gzip --file ${{ env.ARTIFACT_NAME }}.tar.gz dist
tar --verbose --create --xz --file ${{ env.ARTIFACT_NAME }}.tar.xz dist
- name: Calculate checksums
run: |
md5sum ${{ env.ARTIFACT_NAME }}.zip ${{ env.ARTIFACT_NAME }}.tar.gz ${{ env.ARTIFACT_NAME }}.tar.xz > MD5SUMS.txt
sha1sum ${{ env.ARTIFACT_NAME }}.zip ${{ env.ARTIFACT_NAME }}.tar.gz ${{ env.ARTIFACT_NAME }}.tar.xz > SHA1SUMS.txt
sha256sum ${{ env.ARTIFACT_NAME }}.zip ${{ env.ARTIFACT_NAME }}.tar.gz ${{ env.ARTIFACT_NAME }}.tar.xz > SHA256SUMS.txt
sha512sum ${{ env.ARTIFACT_NAME }}.zip ${{ env.ARTIFACT_NAME }}.tar.gz ${{ env.ARTIFACT_NAME }}.tar.xz > SHA512SUMS.txt
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
draft: true
tag_name: ${{ github.ref_name }}
files: |
${{ env.ARTIFACT_NAME }}.zip
${{ env.ARTIFACT_NAME }}.tar.gz
${{ env.ARTIFACT_NAME }}.tar.xz
MD5SUMS.txt
SHA1SUMS.txt
SHA256SUMS.txt
SHA512SUMS.txt
token: ${{ secrets.GITHUB_TOKEN }}