Skip to content

Commit

Permalink
ci: restructure in multiple tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
DanySK committed Jan 25, 2022
1 parent 60b5d52 commit 7805062
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 22 deletions.
81 changes: 62 additions & 19 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,46 @@ jobs:
uses: danysk/[email protected]
- uses: DanySK/[email protected]
with:
build-command: |
./gradlew assemble shadowJar --parallel || ./gradlew assemble shadowJar --parallel
build-command: true
check-command: |
./gradlew check --parallel || ./gradlew check --parallel
clean-command: |
./gradlew clean --parallel
deploy-command: |
./gradlew signKotlinMavenPublication --parallel
./gradlew closeKotlinMavenOnMavenCentralNexus
should-run-codecov: ${{ contains('Linux', runner.os) }}
should-deploy: >-
${{
contains('Linux', runner.os)
&& contains(github.repository, 'AlchemistSimulator/Alchemist')
&& contains('push workflow_dispatch', github.event_name)
}}
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
should-deploy: false
test-shadowjar:
strategy:
matrix:
os: [ windows, macos, ubuntu ]
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: danysk/[email protected]
- uses: DanySK/[email protected]
with:
build-command: |
./gradlew shadowJar --parallel || ./gradlew shadowJar --parallel
check-command: true
java-version: 11
should-run-codecov: false
should-deploy: false
should-validate-wrapper: false
test-deploy:
runs-on: ubuntu-latest
timeout-minutes: 120
if: contains(github.repository, 'AlchemistSimulator/Alchemist') && contains('push workflow_dispatch', github.event_name)
steps:
- name: Checkout
uses: danysk/[email protected]
- uses: DanySK/[email protected]
with:
build-command: ./gradlew signKotlinMavenPublication --parallel
check-command: ./gradlew closeKotlinMavenOnMavenCentralNexus
java-version: 11
should-run-codecov: false
should-deploy: false
should-validate-wrapper: false
maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing-key: ${{ secrets.SIGNING_KEY }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
Expand All @@ -70,11 +93,21 @@ jobs:
docker run --rm -v "$(pwd)/build/website:/website" -e GITHUB_TOKEN lycheeverse/lychee $(echo "$FILES") --exclude-file /website/lycheeignore -m 100 --threads 1
should-run-codecov: false
should-deploy: false
should-validate-wrapper: false
github-token: ${{ secrets.DEPLOYMENT_TOKEN }}
- name: Tar files
run: tar -cvf website.tar build/website
- name: Upload website
uses: actions/[email protected]
with:
name: website
path: website.tar
release:
needs:
- build
- build-website
- test-deploy
- test-shadowjar
runs-on: ubuntu-latest
if: >-
contains('push workflow_dispatch', github.event_name)
Expand All @@ -89,20 +122,30 @@ jobs:
if: contains(github.repository, 'AlchemistSimulator/Alchemist')
uses: actions/[email protected]
with:
path: build/website
path: website
fetch-depth: 0
persist-credentials: true
repository: AlchemistSimulator/alchemistsimulator.github.io
token: ${{ secrets.DEPLOYMENT_TOKEN }}
- name: Cleanup the old website
shell: bash
run: |
rm -rf build/website/*
ls -ahl build/website
- name: Download website artifact
uses: actions/[email protected]
with:
name: website
- uses: DanySK/[email protected]
with:
java-version: 11
build-command: ./gradlew hugoBuild
build-command: |
ls -ahl
echo Copying the new website
tar -xvf website.tar
echo Copying git information
mv website/.git build/website/.git
git -C build/website/ status
echo Removing old website
rm -rf website
echo Adding changes to the stage
git -C build/website/ add .
git -C build/website/ status
check-command: true
deploy-command: |
npm install
Expand Down
7 changes: 4 additions & 3 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
var publishCmd = `
git tag -a -f \${nextRelease.version} \${nextRelease.version} -F CHANGELOG.md
git push --force origin \${nextRelease.version} || exit 6
git --git-dir build/website/.git add . || exit 1
git --git-dir build/website/.git commit -m "chore: update website to version \${nextRelease.version}" || exit 2
git --git-dir build/website/.git push || exit 3
sed 's/version\\s*=\\s*".*"\\s*$/version = "\${nextRelease.version}"/' -i src/main/hugo/config.toml
git -C build/website/ add . || exit 1
git -C build/website/ commit -m "chore: update website to version \${nextRelease.version}" || exit 2
git -C build/website/ push || exit 3
./gradlew shadowJar --parallel || ./gradlew shadowJar --parallel || exit 4
./gradlew releaseKotlinMavenOnMavenCentralNexus --parallel || exit 5
./gradlew publishKotlinMavenPublicationToGithubRepository --continue || true
Expand Down
1 change: 1 addition & 0 deletions src/main/hugo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ relativeURLs = true
themeVariant = "relearn"
disableSeoHiddenPages = true
disableLanguageSwitchingButton = true
version = "12.0.0"

[outputs]
home = ["HTML", "RSS", "JSON"] # add JSON to the home page to support lunr search
Expand Down
2 changes: 2 additions & 0 deletions src/main/hugo/layouts/partials/menu-footer.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<div><strong>Alchemist Simulator {{ .Site.Params.version }}</strong></div>
<br>
<a
class="github-button"
href="https://github.com/AlchemistSimulator/Alchemist/releases/latest/"
Expand Down
1 change: 1 addition & 0 deletions src/main/hugo/layouts/shortcodes/version.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ .Site.Params.version -}}

0 comments on commit 7805062

Please sign in to comment.