-
Notifications
You must be signed in to change notification settings - Fork 5
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
f5a2edf
commit 0a0a90f
Showing
2 changed files
with
75 additions
and
1 deletion.
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,71 @@ | ||
name: Create release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
check-versions: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
TAG_NAME: ${{ env.TAG_NAME }} | ||
VERSION: ${{ steps.get_version.outputs.version }} | ||
steps: | ||
- name: Get tag name | ||
run: | | ||
echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
# Download artifacts from build workflow | ||
- name: Download workflow artifacts | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: build.yml | ||
commit: ${{ github.sha }} | ||
path: '.' | ||
|
||
# Get publish.gradle version | ||
- name: Get publish.gradle version | ||
id: get_version | ||
run: | | ||
echo "version=$(cat version/version.txt)" >> $GITHUB_OUTPUT | ||
echo "expectedTagName=v$(cat version/version.txt)" >> $GITHUB_OUTPUT | ||
# Check publish.gradle version | ||
- name: publish.gradle version check FAILED | ||
if: ${{ steps.get_version.outputs.expectedTagName != env.TAG_NAME }} | ||
run: | | ||
echo Tag name: ${{ env.TAG_NAME }} | ||
echo publish.gradle version: ${{ steps.get_version.outputs.version }} | ||
exit 1 | ||
prepare-release: | ||
runs-on: ubuntu-latest | ||
needs: check-versions | ||
steps: | ||
# Download API, docs, and version.txt | ||
- name: Download workflow artifacts | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: build.yml | ||
commit: ${{ github.sha }} | ||
path: './artifacts' | ||
|
||
# Create new release draft | ||
- name: Create release | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
VERSION=${{ needs.check-versions.outputs.version }} | ||
TAG=v$VERSION | ||
gh release create $TAG --draft --title "Version $VERSION" | ||
echo "Sleep after creating release to avoid race condition" | ||
sleep 5 | ||
gh release upload $TAG CANBridge-${{ github.sha }}/* |
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