Merge remote-tracking branch 'upstream/main' into 3-merge-lnbits-changes #3
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
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Configure Git user name and email | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
# Set a static tag name | |
- name: Set static tag and release name | |
id: set_static_name | |
run: | | |
echo "::set-output name=tag::static-release" | |
echo "::set-output name=release_name::Static Release" | |
# Check if tag exists and delete it if it does | |
- name: Delete existing tag | |
run: | | |
if git rev-parse ${{ steps.set_static_name.outputs.tag }} >/dev/null 2>&1; then | |
git tag -d ${{ steps.set_static_name.outputs.tag }} | |
git push --delete origin ${{ steps.set_static_name.outputs.tag }} | |
fi | |
# Create or move the tag to the current commit | |
- name: Create or move tag | |
run: | | |
git tag -fa ${{ steps.set_static_name.outputs.tag }} -m "${{ steps.set_static_name.outputs.release_name }}" | |
git push origin ${{ steps.set_static_name.outputs.tag }} --force | |
# Check and create or update the release | |
- name: Check and create or update the release | |
run: | | |
RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
https://api.github.com/repos/${{ github.repository }}/releases/tags/static-release | jq .id) | |
if [[ "$RELEASE_ID" != "null" ]]; then | |
echo "Updating existing release..." | |
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Content-Type: application/json" \ | |
https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID \ | |
-d '{"tag_name": "static-release", "name": "Static Release", "body": "Several Changes in this Release", "draft": false, "prerelease": false}' | |
else | |
echo "Creating new release..." | |
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Content-Type: application/json" \ | |
https://api.github.com/repos/${{ github.repository }}/releases \ | |
-d '{"tag_name": "static-release", "name": "Static Release", "body": "Several Changes in this Release", "draft": false, "prerelease": false}' | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |