Skip to content

Commit

Permalink
Update Publish.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Spooks4576 committed Mar 22, 2024
1 parent d9f9cd9 commit 0fdc446
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/Publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,46 @@ jobs:
- name: Tar artifacts
run: tar -czvf ${{ matrix.board }}.tar.gz -C .pio/build/${{ matrix.board }} firmware.bin partitions.bin bootloader.bin

- name: Delete existing tag
run: |
git tag -d release || true
git push origin :refs/tags/release || true
- name: Create new tag
run: |
git tag release
git push origin release
# Check if the release already exists
- name: Check if Release Exists
id: check_release
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { data: releases } = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
const release = releases.find(release => release.tag_name === 'release');
if (release) {
core.setOutput('exists', 'true');
core.setOutput('upload_url', release.upload_url);
} else {
core.setOutput('exists', 'false');
}
# Create Release if it does not exist
- name: Create Release
id: create_release
if: steps.check_release.outputs.exists == 'false'
uses: softprops/action-gh-release@v1
with:
files: |
./${{ matrix.board }}.tar.gz
files: ./${{ matrix.board }}.tar.gz
draft: false
tag_name: release
name: Ghost ESP Release
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Upload assets if the release already exists
- name: Upload assets to Release
if: steps.check_release.outputs.exists == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.board }}.tar.gz
asset_name: ${{ matrix.board }}.tar.gz
tag: release
overwrite: true
url: ${{ steps.check_release.outputs.upload_url }}

0 comments on commit 0fdc446

Please sign in to comment.