-
Notifications
You must be signed in to change notification settings - Fork 79
99 lines (80 loc) · 2.59 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
name: release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
release:
description: 'type "release" to create the release (main branch only)'
required: false
concurrency:
group: release
cancel-in-progress: false
jobs:
dryrun:
if: ${{ github.ref != 'refs/heads/main' || github.event.inputs.release != 'release' }}
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
- name: 🏗 Setup runner
uses: ./.github/actions/setup
- name: 📦 Install dependencies
run: bun install
- name: 📋 Dry-running release
run: bun semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ github.token }}
publish:
if: ${{ github.ref == 'refs/heads/main' && github.event.inputs.release == 'release' }}
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
with:
token: ${{ secrets.EXPOBOT_GITHUB_TOKEN }}
- name: 🏗 Setup runner
uses: ./.github/actions/setup
- name: 📦 Install dependencies
run: bun install
- name: 📋 Release code
run: bun semantic-release
env:
GITHUB_TOKEN: ${{ secrets.EXPOBOT_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: Expo CI
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Expo CI
GIT_COMMITTER_EMAIL: [email protected]
tags:
needs: publish
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4
with:
token: ${{ secrets.EXPOBOT_GITHUB_TOKEN }}
- name: 🏗 Setup runner
uses: ./.github/actions/setup
- name: 👷 Force repo to latest
run: git fetch --all && git pull
- name: 📦 Install dependencies
run: bun install
- name: 📦 Install semver
run: bun add --dev semver
- name: 🕵️ Resolve major version
uses: actions/github-script@v7
id: version
with:
result-encoding: string
script: |
const semver = require('semver')
const { version } = require('./package.json')
return semver.major(version)
- name: 👷 Configure git
run: |
git config user.name "Expo CI"
git config user.email "[email protected]"
- name: 🧹 Clean repo
run: git clean . -xdf && git reset --hard HEAD && git pull && git fetch --tags
- name: 📋 Update tags
run: git tag --force v${{ steps.version.outputs.result }} && git push --force --tags