Skip to content

Commit

Permalink
feat: add a nightly prerelease build to the release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hassec committed May 27, 2021
1 parent b920562 commit 1e05a4e
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
schedule:
- cron: '30 4 * * *'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly

jobs:
Linux:
Expand Down Expand Up @@ -146,13 +154,71 @@ jobs:
- uses: actions/download-artifact@v2
- name: List downloaded files
run: tree -L 3

- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV

- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV

- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
run: echo 'BODY=Exiv2 nightly prerelease build. Please help us improve exiv2 by reporting any issues you encounter :wink:' >> $GITHUB_ENV
- if: env.TAG_NAME != 'nightly'
run: echo 'BODY=See [ChangeLog](doc/ChangeLog) for more information about the changes in this release.' >> $GITHUB_ENV

- name: Cleanup old nightly
if: env.TAG_NAME == 'nightly'
uses: actions/github-script@v4
with:
script: |
try{
const rel_id = await github.repos.getReleaseByTag({
...context.repo,
tag: "nightly"
}).then(result => result.data.id);
console.log( "Found existing nightly release with id: ", rel_id);
}catch{error}{
console.log( "Could not find exsisting nightly relase");
return;
}
try{
github.repos.deleteRelease({
...context.repo,
release_id: rel_id
});
console.log( "Deletion of release successful")
}catch{error}{
console.log( "Deletion of release failed");
return;
}
try{
github.git.deleteRef({
...context.repo,
ref: "refs/tags/nightly"
});
console.log( "Deletion of tag successful")
}catch{error}{
console.log( "Deletion of tag failed");
}
- uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# needs newer relase, but add it once available
#fail_on_unmatched_files: true
body: See [ChangeLog](doc/ChangeLog) for more information about the changes in this release.
body: ${{ env.BODY }}
prerelease: ${{ env.TAG_NAME == 'nightly' }}
tag_name: ${{ env.TAG_NAME }}
files: |
./exiv2-linux64/exiv2-*
./exiv2-macos/exiv2-*
Expand Down

0 comments on commit 1e05a4e

Please sign in to comment.