Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparations for releasing from main #1757

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- rc/1.0.0
pull_request:

jobs:
Expand All @@ -29,8 +28,6 @@ jobs:
publish-staging-simulator:
name: Publish Snaps Simulator to `staging` folder
needs: lint-build-test
# The `rc/1.0.0` branch does not have the `snaps-simulator` package, so we
# only run this job on the `main` branch.
if: ${{ github.ref_name == 'main' }}
permissions:
contents: write
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,7 @@ jobs:
publish-test-snaps:
name: Publish test snaps
needs: is-test-snaps-release
# The `rc/1.0.0` branch does not have `test-snaps` package, so we only run
# this job on the `main` branch.
if: ${{ github.ref_name == 'main' && needs.is-test-snaps-release.outputs.IS_TEST_SNAPS_RELEASE == 'true' }}
if: ${{ needs.is-test-snaps-release.outputs.IS_TEST_SNAPS_RELEASE == 'true' }}
permissions:
contents: write
uses: ./.github/workflows/publish-github-pages.yml
Expand Down Expand Up @@ -271,9 +269,7 @@ jobs:
publish-simulator-versioned:
name: Publish Snaps Simulator to `${{ needs.is-simulator-release.outputs.SIMULATOR_VERSION }}` folder
needs: is-simulator-release
# The `rc/1.0.0` branch does not have the `snaps-simulator` package, so we
# only run this job on the `main` branch.
if: ${{ github.ref_name == 'main' && needs.is-simulator-release.outputs.IS_SIMULATOR_RELEASE == 'true' }}
if: ${{ needs.is-simulator-release.outputs.IS_SIMULATOR_RELEASE == 'true' }}
permissions:
contents: write
uses: ./.github/workflows/publish-github-pages.yml
Expand All @@ -287,9 +283,7 @@ jobs:
publish-simulator-latest:
name: Publish Snaps Simulator to `latest` folder
needs: is-simulator-release
# The `rc/1.0.0` branch does not have the `snaps-simulator` package, so we
# only run this job on the `main` branch.
if: ${{ github.ref_name == 'main' && needs.is-simulator-release.outputs.IS_SIMULATOR_RELEASE == 'true' }}
if: ${{ needs.is-simulator-release.outputs.IS_SIMULATOR_RELEASE == 'true' }}
permissions:
contents: write
uses: ./.github/workflows/publish-github-pages.yml
Expand Down
13 changes: 2 additions & 11 deletions scripts/get-release-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,23 @@ import { prerelease } from 'semver';
import packageJson from '../package.json';

enum Tag {
Flask = 'flask',
Next = 'next',
Latest = 'latest',
}

/**
* Get the release tag from the current branch name and `package.json` version.
* Get the release tag from the `package.json` version.
*
* - If the branch name is `main`, the tag is `flask`.
* - Otherwise, if the version is a prerelease, the tag is `next`.
* - If the version is a prerelease, the tag is `next`.
* - Otherwise, the tag is `latest`.
*
* @returns The release tag.
*/
export function main(): Tag {
const branchName = process.env.GITHUB_REF_NAME;
const { version } = packageJson;

assert(branchName, 'GITHUB_REF_NAME must be set.');
assert(version, '`package.json` must have a version.');

// Currently, Flask releases are deployed from the `main` branch.
if (branchName === 'main') {
return Tag.Flask;
}

// Otherwise, we're on a stable branch, which may or may not be a prerelease.
const prereleaseTag = prerelease(version);
if (prereleaseTag) {
Expand Down