-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #757 from danskernesdigitalebibliotek/DDFLSBP-328-…
…tagged-dependencies-for-better-release Splitting releasing in to two workflows
- Loading branch information
Showing
3 changed files
with
135 additions
and
68 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,84 @@ | ||
name: Create release on branch changes | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
# Dependabot does not have permissions to create releases | ||
- 'dependabot/**' | ||
|
||
jobs: | ||
create_release_on_branch_changes: | ||
name: "Create release on branch changes" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set release variables | ||
id: resolve-release-vars | ||
# Version 0.0.0-SHA is a schema that supports semantic versioning but | ||
# should sink below proper versions. | ||
# Output package.json to provide insight and help debugging | ||
# Using branch names as tags allows other projects to track unreleased | ||
# development. | ||
run: | | ||
RELEASE_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) | ||
RELEASE_SHA=${{ github.sha }} | ||
TAG_NAME=$(echo "branch-${RELEASE_BRANCH}") | ||
echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> "$GITHUB_ENV" | ||
echo "RELEASE_SHA=$RELEASE_SHA" >> "$GITHUB_ENV" | ||
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | ||
echo "BUILD_VERSION=${RELEASE_BRANCH}-${RELEASE_SHA}" >> "$GITHUB_ENV" | ||
echo "DIST_FILENAME=dist-$RELEASE_BRANCH.zip" >> "$GITHUB_ENV" | ||
# Checkout the HEAD of the PR branch to get the latest commit message. | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Get release description | ||
run: | | ||
echo "RELEASE_DESCRIPTION=$(git show -s --format=%s)" >> "$GITHUB_ENV" | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
registry-url: 'https://npm.pkg.github.com' | ||
|
||
- run: yarn install --frozen-lockfile | ||
|
||
- name: Build artifacts | ||
run: yarn build | ||
env: | ||
VERSION_FILE_NAME: ${{ github.repository }} | ||
VERSION_FILE_VERSION: ${{ env.BUILD_VERSION }} | ||
|
||
- name: Zip project | ||
run: | | ||
zip -r -j ${{ env.DIST_FILENAME }} dist/ | ||
- name: Delete existing releases | ||
uses: dev-drprasad/[email protected] | ||
with: | ||
tag_name: ${{ env.TAG_NAME }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
- name: Create or update tag | ||
uses: EndBug/[email protected] | ||
with: | ||
ref: ${{ env.TAG_NAME }} | ||
|
||
- name: Create release | ||
id: create-release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
prerelease: true | ||
target_commitish: ${{ env.RELEASE_SHA }} | ||
tag_name: ${{ env.TAG_NAME }} | ||
body: ${{ env.RELEASE_DESCRIPTION }} | ||
files: ${{ env.DIST_FILENAME }} | ||
|
||
- name: Adding summary | ||
run: | | ||
echo "Release created 🚀😎 at: ${{ steps.create-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY |
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,51 @@ | ||
name: Create release on tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
create_release_on_tag: | ||
name: "Create release on tag" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set release variables | ||
id: resolve-release-vars | ||
run: | | ||
RELEASE_NAME=${{ github.ref_name }} | ||
RELEASE_SHA=${{ github.sha }} | ||
echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV" | ||
echo "RELEASE_SHA=$RELEASE_SHA" >> "$GITHUB_ENV" | ||
echo "BUILD_VERSION=${RELEASE_NAME}-${RELEASE_SHA}" >> "$GITHUB_ENV" | ||
echo "DIST_FILENAME=dist-$RELEASE_NAME-$RELEASE_SHA.zip" >> "$GITHUB_ENV" | ||
- uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
registry-url: 'https://npm.pkg.github.com' | ||
|
||
- run: yarn install --frozen-lockfile | ||
|
||
- name: Build artifacts | ||
run: yarn build | ||
env: | ||
VERSION_FILE_NAME: ${{ github.repository }} | ||
VERSION_FILE_VERSION: ${{ env.BUILD_VERSION }} | ||
|
||
- name: Zip project | ||
run: | | ||
zip -r -j ${{ env.DIST_FILENAME }} dist/ | ||
- name: Create release | ||
id: create-release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: ${{ env.DIST_FILENAME }} | ||
|
||
- name: Adding summary | ||
run: | | ||
echo "Release created 🚀😎 at: ${{ steps.create-release.outputs.url }}" >> $GITHUB_STEP_SUMMARY |
This file was deleted.
Oops, something went wrong.