-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (76 loc) · 2.51 KB
/
azure-static-web-apps-yellow-mushroom-020da8100.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '1 10 * * *'
push:
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8.0.212
uses: actions/setup-java@v3
with:
java-version: 8.0.212
distribution: 'zulu'
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Run Java Application
run: java -jar target/bing-wallpaper-jar-with-dependencies.jar
- name: Save Maven cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- name: Commit files
env:
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
MY_GIT_TOKEN: ${{ secrets.MY_GIT_TOKEN }}
run: |
git config --global user.name $GIT_USERNAME
git config --global user.email $GIT_EMAIL
git pull
if ! git diff --quiet --exit-code; then
git add README.md
git add bing-wallpaper.md
git add picture/*
git add docs/*
git commit -m "update readme.md"
PUSH_OUTPUT=$(git push 2>&1)
echo "$PUSH_OUTPUT"
NEW_COMMIT_SHA=$(echo "$PUSH_OUTPUT" | grep -oP '\S+ -> \S+' | awk '{print $1}')
echo "NEW_COMMIT_SHA=$NEW_COMMIT_SHA" >> $GITHUB_ENV
fi
build_and_deploy_job:
runs-on: ubuntu-latest
needs: build
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
ref: main
submodules: true
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_YELLOW_MUSHROOM_020DA8100 }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "docs"