Skip to content

Commit

Permalink
Use gh cmdline tool to create and delete releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
CptMoore committed Feb 4, 2024
1 parent 431e089 commit 3cbce11
Showing 1 changed file with 22 additions and 49 deletions.
71 changes: 22 additions & 49 deletions .github/workflows/mod-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,60 +52,33 @@ jobs:
working-directory: ${{ inputs.checkout-directory }}
run: ${{ inputs.build-script }}

- name: Delete Latest Release and Tag
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: "latest"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Latest Tag
- name: Release Latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
working-directory: ${{ inputs.checkout-directory }}
run: |
gh release delete latest --cleanup-tag || true
git tag -d latest || true
git push --delete origin refs/tags/latest || true
git tag latest
git push origin latest
- id: release_latest
name: Release Latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
uses: ncipollo/release-action@v1
with:
artifactErrorsFailBuild: true
artifacts: ${{ env.DIST_DIR }}/*
generateReleaseNotes: true
makeLatest: true
name: "Latest (unstable)"
prerelease: true
tag: "latest"
git push --force origin refs/tags/latest
gh release create latest "$DIST_DIR"/* \
--generate-notes \
--title "Latest (unstable)" \
--verify-tag \
--prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- id: release_tag
name: Release Tag
uses: ncipollo/release-action@v1
- name: Release Tag
if: startsWith(github.ref, 'refs/tags/v')
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: ${{ env.DIST_DIR }}/*
body: ${{ inputs.release-notes }}
draft: false
generateReleaseNotes: true
makeLatest: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true

- name: Show release outputs
shell: bash
working-directory: ${{ inputs.checkout-directory }}
run: |
echo 'id: '
echo -n '${{ steps.release_tag.outputs.id }}'
echo -n '${{ steps.release_latest.outputs.id }}'
echo ''
echo ''
echo 'url:'
echo -n '${{ steps.release_tag.outputs.html_url }}'
echo -n '${{ steps.release_latest.outputs.html_url }}'
echo ''
gh release delete "$GITHUB_REF_NAME" || true
gh release create "$GITHUB_REF_NAME" "$DIST_DIR"/* \
--generate-notes \
--notes "$RELEASE_NOTES" \
--verify-tag \
--latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NOTES: ${{ inputs.release-notes }}

0 comments on commit 3cbce11

Please sign in to comment.