-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12f8970
commit 1f4f981
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Production Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Ensure pre-requisites for deployment are met | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
/* | ||
* We should only need to load 1 release here, as pending should be at the top of the list. | ||
* We're loading a few extras here in case we get into a weird state. | ||
*/ | ||
const PAGE_SIZE = 5; | ||
const releases = await github.rest.repos.listReleases({ owner, repo }); | ||
const pendingReleases = releases.data.filter(release => release.prerelease); | ||
if (pendingReleases.length > 1) { | ||
throw new Error(`Found more than one pending release: ${pendingReleases.map(release => release.tag_name).join(', ')}`); | ||
} | ||
const targetRelease = pendingReleases.find(release => release.tag_name === "${{github.ref_name}}"); | ||
if (!targetRelease) { | ||
throw new Error(`No pending release found for tag: ${github.ref_name}`); | ||
} | ||
console.log(`Found pending release, proceeding with deployment: ${targetRelease.url}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters