Skip to content

Commit b7a0df9

Browse files
authored
Merge pull request #3 from WangEdward/main
ci: update release workflow
2 parents a360c55 + f36a902 commit b7a0df9

2 files changed

Lines changed: 68 additions & 146 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,91 +4,97 @@ on:
44
push:
55
tags:
66
- "v*"
7+
branches:
8+
- main
9+
- rc
10+
- beta
11+
- nightly
12+
- hotfix
13+
- "*.x"
714

815
jobs:
916
build:
1017
name: Build
1118
strategy:
1219
fail-fast: false
1320
matrix:
14-
target: [ windows, linux, macos]
21+
target: [windows, linux, macos]
1522
include:
1623
- target: windows
1724
runner: windows-latest
18-
channel: 'beta'
25+
channel: "beta"
1926
artifact: build/windows/x64/runner/Release
2027
- target: linux
2128
runner: ubuntu-latest
22-
channel: 'stable'
29+
channel: "stable"
2330
artifact: build/linux/x64/release/bundle
2431
- target: macos
2532
runner: macos-latest
26-
channel: 'stable'
33+
channel: "stable"
2734
artifact: "build/macos/Build/Products/Release/Past Paper Master.app"
2835
runs-on: ${{ matrix.runner }}
2936
environment: ${{ github.ref_name }}
3037
timeout-minutes: 20
3138
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v3
34-
35-
- name: set version number (unix)
36-
run: echo "VERSION_NUM=$(echo ${{ github.ref }} | cut -d / -f 3)" >> $GITHUB_ENV
37-
if: ${{ matrix.runner == 'ubuntu-latest' }} or ${{ matrix.runner == 'macos-latest' }}
38-
- name: set version number (windows)
39-
run: echo "VERSION_NUM=$(Split-Path -Leaf ${{ github.ref }})" >> $env:GITHUB_ENV
40-
if: ${{ matrix.runner == 'windows-latest' }}
39+
- name: Checkout
40+
uses: actions/checkout@v4
4141

42-
- name: Install Flutter
43-
uses: subosito/flutter-action@v2.10.0
44-
with:
45-
channel: ${{ matrix.channel }}
46-
cache: true
47-
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache
48-
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
49-
architecture: x64 # action no current support for arm64
42+
- name: set version number (unix)
43+
if: ${{ github.event_name == 'tags' }} and ${{ matrix.runner != 'windows-latest' }}
44+
run: echo "VERSION_NUM=$(echo ${{ github.ref }} | cut -d / -f 3)" >> $GITHUB_ENV
45+
- name: set version number (windows)
46+
if: ${{ github.event_name == 'tags' }} and ${{ matrix.runner == 'windows-latest' }}
47+
run: echo "VERSION_NUM=$(Split-Path -Leaf ${{ github.ref }})" >> $env:GITHUB_ENV
5048

51-
- name: Install Dependencies (windows)
52-
if: ${{ matrix.runner == 'windows-latest' }}
53-
run: |
54-
flutter config --enable-windows-desktop
55-
- name: Install Dependencies (linux)
56-
if: ${{ matrix.runner == 'ubuntu-latest' }}
57-
run: |
58-
sudo apt-get update -y
59-
sudo apt-get install -y ninja-build libgtk-3-dev
60-
flutter config --enable-linux-desktop
61-
- name: Install Dependencies (macos)
62-
if: ${{ matrix.runner == 'macos-latest' }}
63-
run: |
64-
flutter config --enable-macos-desktop
49+
- name: Install Flutter
50+
uses: subosito/flutter-action@v2.13.0
51+
with:
52+
channel: ${{ matrix.channel }}
53+
cache: true
6554

66-
- name: Build Flutter ${{ matrix.target }}
67-
run: |
68-
make build ${{ matrix.target }}
55+
- name: Install Dependencies (windows)
56+
if: ${{ matrix.runner == 'windows-latest' }}
57+
run: |
58+
flutter config --enable-windows-desktop
59+
- name: Install Dependencies (linux)
60+
if: ${{ matrix.runner == 'ubuntu-latest' }}
61+
run: |
62+
sudo apt-get update -y
63+
sudo apt-get install -y ninja-build libgtk-3-dev
64+
flutter config --enable-linux-desktop
65+
- name: Install Dependencies (macos)
66+
if: ${{ matrix.runner == 'macos-latest' }}
67+
run: |
68+
flutter config --enable-macos-desktop
6969
70-
- name: Zip artifact (Windows)
71-
if: ${{ matrix.runner == 'windows-latest' }}
72-
shell: pwsh
73-
run: Compress-Archive "${{ matrix.artifact }}" "ppm-${{ matrix.target }}-$Env:VERSION_NUM.zip"
74-
- name: Zip artifact (Linux)
75-
if: ${{ matrix.runner == 'ubuntu-latest' }}
76-
shell: bash
77-
run: tar -C "$(dirname ${{ matrix.artifact }})" -czf "ppm-${{ matrix.target }}-${VERSION_NUM}.tar.gz" "$(basename ${{ matrix.artifact }})" --transform "s/$(basename ${{ matrix.artifact }})/PastPaperMaster/"
78-
- name: Zip artifact (MacOS)
79-
if: ${{ matrix.runner == 'macos-latest' }}
80-
shell: bash
81-
run: tar -C "$(dirname "${{ matrix.artifact }}")" -czf "ppm-${{ matrix.target }}-${VERSION_NUM}.tar.gz" "$(basename "${{ matrix.artifact }}")"
70+
- name: Build Flutter ${{ matrix.target }}
71+
run: |
72+
make build ${{ matrix.target }}
8273
83-
- name: Upload artifact
84-
uses: actions/upload-artifact@v3
85-
with:
86-
name: ppm-${{ matrix.target }}-${{ env.VERSION_NUM }}
87-
path: ppm-${{ matrix.target }}-${{ env.VERSION_NUM }}.*
88-
- uses: ncipollo/release-action@v1
89-
with:
90-
artifacts: ppm-${{ matrix.target }}-${{ env.VERSION_NUM }}.*
91-
token: ${{ secrets.GITHUB_TOKEN }}
92-
allowUpdates: true
93-
draft: true
94-
bodyFile: ".github/docs/release-notes.md"
74+
- name: Zip artifact (Windows)
75+
if: ${{ matrix.runner == 'windows-latest' }}
76+
shell: pwsh
77+
run: Compress-Archive "${{ matrix.artifact }}" "ppm-${{ matrix.target }}-$Env:VERSION_NUM.zip"
78+
- name: Zip artifact (Linux)
79+
if: ${{ matrix.runner == 'ubuntu-latest' }}
80+
shell: bash
81+
run: tar -C "$(dirname ${{ matrix.artifact }})" -czf "ppm-${{ matrix.target }}-${VERSION_NUM}.tar.gz" "$(basename ${{ matrix.artifact }})" --transform "s/$(basename ${{ matrix.artifact }})/PastPaperMaster/"
82+
- name: Zip artifact (MacOS)
83+
if: ${{ matrix.runner == 'macos-latest' }}
84+
shell: bash
85+
run: brew install create-dmg && create-dmg --icon "Past Paper Master.app" 200 190 --app-drop-link 600 185 --volname "PastPaperMaster" "ppm-${{ matrix.target }}-${VERSION_NUM}.dmg" "${{ matrix.artifact }}"
86+
87+
- name: Upload artifact
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: ppm-${{ matrix.target }}-${{ env.VERSION_NUM }}
91+
path: ppm-${{ matrix.target }}-${{ env.VERSION_NUM }}.*
92+
93+
- uses: ncipollo/release-action@v1
94+
if: ${{ github.event_name == 'tags' }}
95+
with:
96+
artifacts: ppm-${{ matrix.target }}-${{ env.VERSION_NUM }}.*
97+
token: ${{ secrets.GITHUB_TOKEN }}
98+
allowUpdates: true
99+
draft: true
100+
bodyFile: ".github/docs/release-notes.md"

0 commit comments

Comments
 (0)