Repository navigation
85 lines (79 loc) · 2.92 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (79 loc) · 2.92 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Builds Morpho Match and its two-player server and, on a tag, publishes them
# as a GitHub release, so a check or a CI job can install the game without
# building it: `gh release download -R mobiumdev/morpho-match`, or
# https://github.com/mobiumdev/morpho-match/releases/latest/download/<file>.
#
# The file names do not carry the version, so that latest/download URL
# stays the same from release to release. The APK runs on a phone and on a
# Meta Quest, and is signed with the runner's debug key: an app under test,
# never published to a store. The server listens on 127.0.0.1:8787 unless
# given -addr.
#
# It is also the repository's CI: every pull request and every push to main
# builds everything and publishes nothing, so a change that breaks a build
# or a unit test fails before it is merged rather than at the next tag. A
# failure on main opens an issue (failure-issue.yml).
name: Release
on:
push:
branches: [main]
tags: ['v*']
pull_request:
workflow_dispatch:
permissions:
contents: read
# A pull request's earlier run is superseded by its newest commit.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '21'
- run: ./gradlew --no-daemon :app:testDebugUnitTest :app:assembleRelease
working-directory: android
- run: cp android/app/build/outputs/apk/release/app-release.apk MorphoMatch-android.apk
- uses: actions/upload-artifact@v7
with:
name: android
path: MorphoMatch-android.apk
server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: server/go.mod
- run: go test ./...
working-directory: server
- run: |
for t in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64; do
os=${t%/*}; arch=${t#*/}; ext=; [ "$os" = windows ] && ext=.exe
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -trimpath -o "../morpho-match-server-$os-$arch$ext" .
done
working-directory: server
- uses: actions/upload-artifact@v7
with:
name: server
path: morpho-match-server-*
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [android, server]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- run: sha256sum -- * > SHA256SUMS
working-directory: dist
- run: gh release create "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --title "Morpho Match $GITHUB_REF_NAME" --generate-notes
env:
GH_TOKEN: ${{ github.token }}