-
Notifications
You must be signed in to change notification settings - Fork 28
64 lines (54 loc) · 2.11 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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