forked from latticexyz/mud
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (58 loc) · 2.29 KB
/
Copy pathprerelease.yml
File metadata and controls
69 lines (58 loc) · 2.29 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
name: Prerelease 🚀
on:
workflow_dispatch:
# Ensure only one workflow/job is publishing to npm at a time
concurrency: publish-to-npm
env:
NODE_OPTIONS: "--max-old-space-size=4096"
jobs:
prerelease:
name: Changesets Prerelease
if: github.repository == 'latticexyz/mud'
runs-on: ubuntu-latest
# Permissions necessary for Changesets to push a new branch and open PRs
# (for automated Version Packages PRs), and request the JWT for provenance.
# More info: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup
uses: ./.github/actions/setup
- name: Set deployment token
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Check for pre.json file existence
id: check_files
uses: andstor/file-existence-action@v2.0.0
with:
files: ".changeset/pre.json"
- name: Enter next prerelease mode
# If .changeset/pre.json does not exist and we did not recently exit
# prerelease mode, enter prerelease mode with tag next
if: steps.check_files.outputs.files_exists == 'false' && !contains(github.event.head_commit.message, 'Exit prerelease')
run: npx changeset pre enter next
- name: Get next release version
id: next-version
run: |
pnpm changeset status --output=release.json
echo "version=$(cat release.json | jq -r '.releases[0].newVersion')" >> "$GITHUB_OUTPUT"
rm release.json
- name: Create next version PR or publish 🚀
uses: changesets/action@v1
with:
title: "chore: release v${{steps.next-version.outputs.version}}"
commit: "chore: release v${{steps.next-version.outputs.version}}"
version: pnpm release:version
publish: pnpm release:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker:
uses: ./.github/workflows/docker.yml
needs: prerelease