YimActions Zip Release #8
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
name: YimActions Zip Release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**.lua' | |
workflow_dispatch: | |
jobs: | |
delete_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Delete Existing Release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const owner = context.repo.owner; | |
const repo = context.repo.repo; | |
const tag = "final"; | |
const releases = await github.rest.repos.listReleases({ | |
owner: owner, | |
repo: repo, | |
}); | |
const release = releases.data.find(release => release.tag_name === tag); | |
if (release) { | |
await github.rest.repos.deleteRelease({ | |
owner: owner, | |
repo: repo, | |
release_id: release.id, | |
}); | |
console.log(`Deleted release with ID ${release.id}`); | |
} else { | |
console.log("No existing release to delete"); | |
} | |
try { | |
await github.rest.git.deleteRef({ | |
owner: owner, | |
repo: repo, | |
ref: `tags/${tag}`, | |
}); | |
console.log(`Deleted tag ${tag}`); | |
} catch (error) { | |
console.error(`Error deleting tag: ${error.message}`); | |
} | |
create_archive: | |
runs-on: ubuntu-latest | |
needs: delete_release | |
steps: | |
- uses: actions/checkout@master | |
- name: Create Zip Archive | |
uses: thedoctor0/zip-release@0.7.6 | |
with: | |
type: 'zip' | |
filename: "YimActions.zip" | |
exclusions: /.git* *.json *.md | |
upload_release: | |
runs-on: ubuntu-latest | |
needs: create_archive | |
steps: | |
- uses: actions/checkout@master | |
- name: Upload New Release | |
uses: ncipollo/release-action@v1.14.0 | |
with: | |
artifacts: "YimActions.zip" | |
name: YimActions | |
tag: "final" |