Skip to content

Commit

Permalink
Add workflow_dispatch trigger for release (#24)
Browse files Browse the repository at this point in the history
* Add release workflow

* Fix sed

* configure git user

* Push branch as well

* Release 6.0.0-pre612b5dd8a9d4f15c9884a2280de88f3e9ba53073

* Update Package.swift

---------

Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
louwers and GitHub Actions authored Jan 4, 2024
1 parent 536a0ab commit 71237cd
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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:
description: Changelog for 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: 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: ${{ github.event.inputs.changelog }}
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ let package = Package(
name: "MapLibre Native",
products: [
.library(
name: "Mapbox",
targets: ["Mapbox"])
name: "MapLibre",
targets: ["MapLibre"])
],
dependencies: [
],
targets: [
.binaryTarget(
name: "Mapbox",
name: "MapLibre",
url: "https://github.com/maplibre/maplibre-native/releases/download/ios-v5.13.0/Mapbox-5.13.0.zip",
checksum: "6f52b877c639c022f59984b346d0758cc7e34ac19d8b2110d0444df32bfe140f")
]
Expand Down

0 comments on commit 71237cd

Please sign in to comment.