You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
4 months ago
|
name: Update Meson Version and Recreate Release
|
||
|
|
||
|
on:
|
||
|
release:
|
||
|
types: [published]
|
||
|
|
||
|
jobs:
|
||
|
update-version:
|
||
|
runs-on: ubuntu-latest
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout repository
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||
|
fetch-depth: 0
|
||
|
|
||
|
- name: Install GitHub CLI
|
||
|
run: sudo apt-get install -y gh
|
||
|
|
||
|
- name: Extract version from release
|
||
|
id: extract_version
|
||
|
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
|
||
|
|
||
|
- name: Fetch release description
|
||
|
id: fetch_description
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
run: |
|
||
|
TAG_NAME=${{ env.version }}
|
||
|
DESCRIPTION=$(gh release view $TAG_NAME --json body -q .body)
|
||
|
echo "description=$DESCRIPTION" >> $GITHUB_ENV
|
||
|
|
||
|
- name: Update meson.build
|
||
|
run: |
|
||
|
VERSION=${{ env.version }}
|
||
|
sed -i "s/^\(\s*version\s*:\s*'\)[^']*'/\1${VERSION}'/" meson.build
|
||
|
|
||
|
- name: Commit changes
|
||
|
run: |
|
||
|
git config --global user.name "github-actions[bot]"
|
||
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||
|
git add meson.build
|
||
|
git commit -m "Update version to ${{ env.version }}"
|
||
|
git push origin HEAD:refs/heads/master
|
||
|
|
||
|
- name: Force-update tag
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
run: |
|
||
|
TAG_NAME=${{ env.version }}
|
||
|
git tag -fa $TAG_NAME -m "Update tag to include version update"
|
||
|
git push origin --force $TAG_NAME
|
||
|
|
||
|
- name: Recreate release
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
run: |
|
||
|
TAG_NAME=${{ env.version }}
|
||
|
DESCRIPTION=${{ env.description }}
|
||
|
gh release delete $TAG_NAME --yes
|
||
|
gh release create $TAG_NAME --target $(git rev-parse HEAD) --title "$TAG_NAME" --notes "$DESCRIPTION"
|
||
|
|
||
|
- name: Trigger other workflows
|
||
|
env:
|
||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
|
run: |
|
||
|
TAG_NAME=${{ env.version }}
|
||
|
gh workflow run .github/workflows/build-source.yml --ref $TAG_NAME
|
||
|
gh workflow run .github/workflows/build-package.yml --ref $TAG_NAME
|