Skip to content

Commit cdccd05

Browse files
committed
Update CI/CD workflows to deploy web app and use Gradle setup actions
1 parent f8a366a commit cdccd05

3 files changed

Lines changed: 74 additions & 20 deletions

File tree

.github/workflows/build_only.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@ jobs:
1515
runs-on: macos-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- name: Cache gradle
19-
uses: actions/cache@v4
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: 'temurin'
22+
java-version: 17
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v4
2025
with:
21-
path: ~/.gradle/caches
22-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
23-
restore-keys: |
24-
${{ runner.os }}-gradle-
26+
cache-read-only: false
27+
cache-overwrite-existing: true
2528
- name: Decrypt large secret
2629
run: ./.github/scripts/decrypt_secret.sh
2730
env:
2831
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
29-
- name: Set up JDK 17
30-
uses: actions/setup-java@v1
31-
with:
32-
java-version: 17
3332
- name: Build
3433
run: ./gradlew build

.github/workflows/build_publish.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,20 @@ jobs:
1111
runs-on: macos-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Cache gradle
15-
uses: actions/cache@v4
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'temurin'
18+
java-version: 17
19+
- name: Setup Gradle
20+
uses: gradle/actions/setup-gradle@v4
1621
with:
17-
path: ~/.gradle/caches
18-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
19-
restore-keys: |
20-
${{ runner.os }}-gradle-
22+
cache-read-only: false
23+
cache-overwrite-existing: true
2124
- name: Decrypt large secret
2225
run: ./.github/scripts/decrypt_secret.sh
2326
env:
2427
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
25-
- name: Set up JDK 17
26-
uses: actions/setup-java@v1
27-
with:
28-
java-version: 17
2928
- name: Build
3029
run: ./gradlew build
3130
- name: Publish

.github/workflows/gh-pages.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build & Deploy CI/CD
2+
3+
on:
4+
push:
5+
branches: ["master", "dev"]
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: Set up JDK 17
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: 'temurin'
32+
java-version: 17
33+
- name: Setup Gradle
34+
uses: gradle/actions/setup-gradle@v4
35+
with:
36+
cache-read-only: false
37+
cache-overwrite-existing: true
38+
- name: "Build WasmJS App"
39+
run: gradle :sample:wasmJsBrowserDistribution
40+
- name: Setup Pages
41+
uses: actions/configure-pages@v5
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: ./sample/build/dist/wasmJs/productionExecutable
46+
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
runs-on: ubuntu-latest
52+
needs: build
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)