-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github: bump actions and refactor release workflow
Signed-off-by: Joachim Wiberg <[email protected]>
- Loading branch information
Showing
4 changed files
with
34 additions
and
41 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
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
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 |
---|---|---|
|
@@ -7,56 +7,49 @@ on: | |
|
||
jobs: | ||
release: | ||
name: Create GitHub release | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
release_id: ${{ steps.create_release.outputs.id }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Extract ChangeLog entry ... | ||
# Hack to extract latest entry for body_path below | ||
run: | | ||
awk '/-----*/{if (x == 1) exit; x=1;next}x' ChangeLog.md \ | ||
|head -n -1 > release.md | ||
cat release.md | ||
- name: Create release ... | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: netcalc ${{ github.ref }} | ||
body_path: release.md | ||
draft: false | ||
prerelease: false | ||
tarball: | ||
name: Build and upload release tarball | ||
needs: release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
- name: Installing dependencies ... | ||
run: | | ||
sudo apt-get -y update | ||
sudo apt-get -y install bats | ||
- name: Setting release variables ... | ||
id: build | ||
run: | | ||
ver=${GITHUB_REF#refs/tags/} | ||
echo "ver=${ver}" >> $GITHUB_OUTPUT | ||
if echo $ver | grep -qE '^v[0-9]+\.[0-9]+(\.[0-9]+)?(-alpha|-beta|-rc)[0-9]*$'; then | ||
echo "pre=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "pre=false" >> $GITHUB_OUTPUT | ||
fi | ||
if echo $ver | grep -qE '^v[0-9.]+\.[0-9.]+(\.[0-9]+)?$'; then | ||
echo "latest=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "latest=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Creating Makefiles ... | ||
run: | | ||
./autogen.sh | ||
./configure | ||
- name: Build release ... | ||
run: | | ||
make release | ||
make release || (cat test/test-suite.log; false) | ||
ls -lF ../ | ||
mkdir -p artifacts/ | ||
mv ../*.tar.* artifacts/ | ||
- name: Upload release artifacts ... | ||
uses: skx/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract ChangeLog entry ... | ||
run: | | ||
awk '/-----*/{if (x == 1) exit; x=1;next}x' ChangeLog.md \ | ||
|head -n -1 > release.md | ||
cat release.md | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
releaseId: ${{ needs.release.outputs.release_id }} | ||
args: artifacts/* | ||
name: netcalc ${{ github.ref_name }} | ||
prerelease: ${{ steps.build.outputs.pre }} | ||
makeLatest: ${{ steps.build.outputs.latest }} | ||
bodyFile: "release.md" | ||
artifacts: "artifacts/*" |