Skip to content

Commit dd25553

Browse files
authored
Update GitHub Actions workflows to latest (#34)
* Update actions/checkout to v4 * Always use latest theos upstream * Remove TODO to use a matrix for release workflow A matrix would be more difficult to manage because all the artifacts would need to be uploaded and then downloaded to attach to the release * Migrate to creating GitHub Releases using the official CLI The `actions/create-release` action is no longer maintained. Also migrate to workflow specific-tokens instead of an access token stored in Secrets * Migrate to latest step output API * Switch test workflow to use same steps as release workflow Using the a build workflow closer to the release workflow means we're testing the code we're actually deploying
1 parent 2c0b128 commit dd25553

File tree

4 files changed

+49
-32
lines changed

4 files changed

+49
-32
lines changed

.github/workflows/build_and_test.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,40 @@ name: Build and Test
33
on: [push, pull_request]
44

55
jobs:
6-
build-and-test:
6+
test:
77
runs-on: macos-12
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
with:
1111
submodules: true
12-
- name: Build
13-
run: swift build -v
1412
- name: Run tests
15-
run: swift test -v
13+
run: swift test
14+
15+
build:
16+
strategy:
17+
matrix:
18+
xcode-version: [ "11.7", "12.4" ]
19+
package-scheme: [ "", "rootless" ]
20+
# match release workflow
21+
runs-on: macos-11
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
submodules: true
26+
path: orion
27+
- name: Set Up Dependencies
28+
run: |
29+
brew install ldid make fakeroot
30+
echo "THEOS=${GITHUB_WORKSPACE}/theos" >> "${GITHUB_ENV}"
31+
echo "PATH=/usr/local/opt/make/libexec/gnubin:${PATH}" >> "${GITHUB_ENV}"
32+
- name: Install Theos
33+
uses: actions/checkout@v4
34+
with:
35+
repository: theos/theos
36+
path: theos
37+
submodules: recursive
38+
- name: Build
39+
run: |
40+
cd orion
41+
DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer \
42+
make THEOS_PACKAGE_SCHEME="${{ matrix.package-scheme }}"

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
docs:
1111
runs-on: macos-12
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
with:
1515
submodules: true
1616
path: master-branch
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
with:
1919
ref: docs
2020
path: docs-branch

.github/workflows/release.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ on:
77

88
jobs:
99
release:
10+
# needed to be able to create a Release
11+
permissions:
12+
contents: write
1013
# We need to use an old runner for Xcode 11.7
11-
# TODO: Use a matrix instead
1214
runs-on: macos-11
1315
steps:
14-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1517
with:
1618
submodules: true
1719
path: orion
@@ -21,12 +23,11 @@ jobs:
2123
brew install ldid make fakeroot
2224
echo "THEOS=${GITHUB_WORKSPACE}/theos" >> "${GITHUB_ENV}"
2325
echo "PATH=/usr/local/opt/make/libexec/gnubin:${PATH}" >> "${GITHUB_ENV}"
24-
echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
26+
echo "version=${GITHUB_REF#refs/tags/}" >> "${GITHUB_OUTPUT}"
2527
- name: Install Theos
26-
uses: actions/checkout@v2
28+
uses: actions/checkout@v4
2729
with:
2830
repository: theos/theos
29-
ref: 153c50c49dbbac0b47b87f9480d8d2c5d6d2ace1
3031
path: theos
3132
submodules: recursive
3233
- name: Build Release
@@ -38,24 +39,13 @@ jobs:
3839
DEVELOPER_DIR=/Applications/Xcode_11.7.app/Contents/Developer make clean package FINALPACKAGE=1
3940
cd packages
4041
zip -yr9 Orion_${{ steps.setup.outputs.version }}.zip *
41-
cd ..
4242
- name: Create Release
43-
id: create_release
44-
uses: actions/create-release@v1
4543
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
with:
48-
tag_name: ${{ github.ref }}
49-
release_name: ${{ steps.setup.outputs.version }}
50-
body: ''
51-
draft: true
52-
prerelease: false
53-
- name: Upload Release
54-
uses: actions/upload-release-asset@v1
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
with:
58-
upload_url: ${{ steps.create_release.outputs.upload_url }}
59-
asset_path: ${{ github.workspace }}/orion/packages/Orion_${{ steps.setup.outputs.version }}.zip
60-
asset_name: Orion_${{ steps.setup.outputs.version }}.zip
61-
asset_content_type: application/zip
44+
GH_TOKEN: ${{ github.token }}
45+
run: |
46+
gh release create ${{ github.ref_name }} \
47+
--verify-tag \
48+
--draft \
49+
--repo ${{ github.repository }} \
50+
--title '${{ steps.setup.outputs.version }}' \
51+
orion/packages/Orion_${{ steps.setup.outputs.version }}.zip

.github/workflows/swiftlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
- name: GitHub Action for SwiftLint
1111
uses: norio-nomura/[email protected]

0 commit comments

Comments
 (0)