release #21
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: release | |
on: | |
workflow_dispatch: | |
inputs: | |
download_url: | |
description: URL where zip containing XCFramework can be downloaded | |
required: true | |
type: string | |
version: | |
description: Version number of release | |
required: true | |
type: string | |
changelog_url: | |
description: URL for changelog of release | |
required: false | |
type: string | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download zip, compute checksum | |
run: | | |
wget ${{ github.event.inputs.download_url }} | |
echo checksum="$(swift package compute-checksum MapLibre.dynamic.xcframework.zip)" >> "$GITHUB_ENV" | |
- name: Insert new checksum in Package.swift | |
run: | | |
sed -i 's#\(checksum: "\)\([^"]*\)#\1${{ env.checksum }}#' Package.swift | |
- name: Insert download URL in Package.swift | |
run: | | |
sed -i 's#\(url: "\)\([^"]*\)#\1${{ github.event.inputs.download_url }}#' Package.swift | |
- name: Validate Package.swift | |
run: swift package describe | |
- name: Push Package.swift | |
run: | | |
git add Package.swift | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git commit -m "Release ${{ github.event.inputs.version }}" | |
git tag -a ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }}" | |
git push --atomic origin main ${{ github.event.inputs.version }} | |
- name: Download changelog.md | |
if: github.event.inputs.changelog_url != '' | |
run: wget -O changelog.md ${{ github.event.inputs.changelog_url }} | |
- name: Create empty changelog.md | |
if: github.event.inputs.changelog_url == '' | |
run: touch changelog.md | |
- name: Make release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ github.event.inputs.version }} | |
tag_name: ${{ github.event.inputs.version }} | |
prerelease: ${{ contains(github.event.inputs.version, 'pre') }} | |
body_path: changelog.md |