Skip to content

Commit

Permalink
chore: fix release action (#2511)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs authored Mar 21, 2024
1 parent c16854a commit 1a22b71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ name: Prerelease 🚀

on:
push:
branches:
- "main"
paths-ignore:
- "docs/**"
workflow_dispatch:

# Ensure only one workflow/job is publishing to npm at a time
concurrency: publish-to-npm
Expand All @@ -23,8 +20,8 @@ jobs:
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v3
name: Checkout Repo
- name: Checkout Repo
uses: actions/checkout@v3
with:
submodules: recursive

Expand Down
38 changes: 14 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,55 @@
name: Version 🔖
name: Release 🔖

on:
push:
branches:
- v2
- "main"
paths-ignore:
- "docs/**"

# Ensure only one workflow/job is publishing to npm at a time
concurrency: publish-to-npm

jobs:
version:
release:
name: Release
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
- name: Checkout Repo
uses: actions/checkout@v3
with:
submodules: recursive

- name: "Setup"
uses: ./.github/actions/setup

- name: Clean
shell: bash
run: pnpm turbo run clean --force --concurrency 10

# Build without cache to ensure we release with the most accurate output
- name: Build
shell: bash
run: pnpm turbo run build --force --concurrency 10

- name: Outdated files, run `pnpm build` and commit them
uses: ./.github/actions/require-empty-diff
- 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/[email protected]
with:
files: ".changeset/pre.json"

- name: Set deployment token
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"

# https://github.com/changesets/action#with-publishing
- name: Handle Release Pull Request or Publish to npm
id: changesets
- name: Create version PR or publish 🚀
if: steps.check_files.outputs.files_exists == 'false'
uses: changesets/action@v1
with:
title: "chore: version packages 🔖"
commit: "chore: version packages 🔖"
publish: pnpm release:publish
version: pnpm release:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

docker:
uses: ./.github/workflows/docker.yml
Expand Down

0 comments on commit 1a22b71

Please sign in to comment.