-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (62 loc) · 2.07 KB
/
release.yml
File metadata and controls
74 lines (62 loc) · 2.07 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
69
70
71
72
73
74
name: Release
on:
pull_request:
types: [closed]
branches: [main]
workflow_dispatch:
jobs:
get-tag:
if: (github.head_ref == 'knope/pre-release' && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: "Get tag of latest draft release"
run: echo "tag_name=$(gh release list --repo ${{ github.repository }} --json 'isDraft,tagName' --jq '.[] | select(.isDraft) | .tagName')" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.CI_WORKER_PAT }}
id: get-tag
- name: Echo tag
run: echo "tag_name=${{ steps.get-tag.outputs.tag_name }}"
outputs:
tag_name: ${{ steps.get-tag.outputs.tag_name }}
release:
needs: get-tag
runs-on: ubuntu-latest
environment:
name: production
url: https://zaidan.carere.dev
env:
GH_TOKEN: ${{ secrets.CI_WORKER_PAT }}
permissions:
id-token: write
contents: write
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Set up Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build registry (Kobalte)
run: bun run r:build:kobalte
- name: Build project
run: bun run build
- name: Create release
run: |
gh release edit ${{ needs.get-tag.outputs.tag_name }} --draft=false --latest
- name: Create tag
run: |
git tag ${{ needs.get-tag.outputs.tag_name }}
git push origin ${{ needs.get-tag.outputs.tag_name }}
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}