-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from jonathanmtran/main
Build and deploy to GitHub pages
- Loading branch information
Showing
2 changed files
with
100 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Continuous deployment | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Install clojure tools | ||
uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: 1.11.1.1347 | ||
|
||
- name: Cache clojure dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
~/.gitlibs | ||
~/.deps.clj | ||
# List all files containing dependencies: | ||
key: cljdeps-${{ hashFiles('deps.edn') }} | ||
#key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }} | ||
#key: cljdeps-${{ hashFiles('project.clj') }} | ||
#key: cljdeps-${{ hashFiles('build.boot') }} | ||
restore-keys: cljdeps- | ||
|
||
- run: clojure -M:build | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: | | ||
dist | ||
deploy: | ||
if: github.ref_name == 'main' | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
|
||
- name: Fix permissions | ||
run: | | ||
chmod -v -R +rX "artifact/" | while read line; do | ||
echo "::warning title=Invalid file permissions automatically fixed::$line" | ||
done | ||
- name: Upload Pages artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: artifact/ | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters