-
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.
* ci.yml: Added branch rules, added prerelease deployment job * Renamed deploy.yml -> cd.yml: Now triggered on push to main, autotagging of release, workflow undeploys prereleases * ci.yml: Updated method for checking out number of commits on branch * ci.yml: dorny/paths-filter action now uses hash instead of version
- Loading branch information
Showing
3 changed files
with
108 additions
and
14 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,75 @@ | ||
name: CD | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
generate-tag: | ||
name: Generate Tag Name | ||
# Get the tag name from the branch that was merged into main, which | ||
# is of the form `pre-<version>`. | ||
# We assume that this will always be the most recent merged PR, as | ||
# this workflow kicks off immediately after the merge completes. | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
outputs: | ||
name: ${{ steps.tag.outputs.name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Generate Tag | ||
id: tag | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GH_REPO: ${{ github.repository }} | ||
# We use the `gh` utility as it offers much easier traversal of GitHub- | ||
# related things (prs, issues, etc...). | ||
# The `cut` command splits the `pre-<version>` branch into just `<version>`, | ||
# which will be the new tag. | ||
run: | | ||
merged_branch=$(gh pr list \ | ||
--state merged \ | ||
--limit 1 \ | ||
--json 'headRefName' \ | ||
--jq '.[].headRefName') | ||
echo "name=$(cut --delimiter '-' --fields 2 <<< '$merged_branch')" >> $GITHUB_OUTPUT | ||
undeploy-prereleases: | ||
name: Undeploy Prereleases | ||
needs: | ||
- generate-tag | ||
uses: access-nri/build-cd/.github/workflows/undeploy-1-setup.yml@main | ||
with: | ||
version-pattern: ${{ needs.generate-tag.outputs.name }}-* | ||
secrets: inherit | ||
|
||
deploy-release: | ||
name: Deploy Release | ||
needs: | ||
- generate-tag | ||
uses: access-nri/build-cd/.github/workflows/deploy-1-setup.yml@main | ||
with: | ||
version: ${{ needs.generate-tag.outputs.name }} | ||
secrets: inherit | ||
permissions: | ||
contents: write | ||
|
||
push-tag: | ||
name: Tag Deployment | ||
needs: | ||
- generate-tag | ||
- deploy-release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Push Tag | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git tag ${{ needs.generate-tag.outputs.name }} | ||
git push --tags |
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 was deleted.
Oops, something went wrong.