Skip to content

Commit

Permalink
Revert to old tag/release action
Browse files Browse the repository at this point in the history
  • Loading branch information
lazerwalker committed Apr 28, 2021
1 parent 01a0dcd commit fdfeb98
Showing 1 changed file with 33 additions and 17 deletions.
50 changes: 33 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,43 +97,59 @@ jobs:
# This makes sure a different process (e.g. a Windows build vs Mac build) hasn't created it
- name: Check if auto-generated tag exists
uses: actions/github-script@v4
id: autogeneratedTagExists
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = await github.git.getTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag_sha: `${context.runNumber}.0.0`
})
console.log(result)
return result
try {
const result = await github.git.getTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag_sha: `${context.runNumber}.0.0`
})
console.log(result)
return true
} catch(e) {
console.log("Failed", e)
return false
}
- name: Create tag if needed
uses: negz/create-tag@v1
if: ${{ steps.automatedTagExists.outputs.result && !startsWith(github.ref, 'refs/tags/v') }}
with:
version: ${{ format('{0}.0.0', github.run_number) }}
message: Auto-generated by GitHub Actions
token: ${{ secrets.GITHUB_TOKEN }}

# The next two steps are identical, except for explicitly passing in the tag name in the latter
# I wish I knew how to do this in a more elegant way.
# See also: I'd love to abstract out the startsWith() check and generated tag name into variable

- name: Release on GitHub (Built via Tag)
uses: ncipollo/release-action@v1
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: |
files: |
app/out/**/*.deb
app/out/**/*.dmg
app/out/**/*Setup.exe
app/out/**/*.rpm
app/out/**/*.zip
app/out/**/*.zip
- name: Release on GitHub (Automated Tag)
uses: ncipollo/release-action@v1
uses: softprops/action-gh-release@v1
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ format('{0}.0.0', github.run_number) }}
commit: github.sha
artifacts: |
tag_name: ${{ format('{0}.0.0', github.run_number) }}
files: |
app/out/**/*.deb
app/out/**/*.dmg
app/out/**/*Setup.exe
app/out/**/*.rpm
app/out/**/*.zip
app/out/**/*.zip

0 comments on commit fdfeb98

Please sign in to comment.