Skip to content

Commit

Permalink
Preparations for releasing from main (#1757)
Browse files Browse the repository at this point in the history
* Prepare to release everything from main

* Fix typo

Co-authored-by: Hassan Malik <[email protected]>

---------

Co-authored-by: Hassan Malik <[email protected]>
  • Loading branch information
FrederikBolding and hmalik88 authored Sep 21, 2023
1 parent c554189 commit 814188a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
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

0 comments on commit 814188a

Please sign in to comment.