Build and Deploy #85
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
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# | |
# Preparation | |
# | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Node.js and NPM | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
# | |
# Retrieve album data | |
# | |
- name: Generate artist and album files | |
env: | |
SPOTIFY_ALBUM_REPO_ACCESS_TOKEN: ${{ secrets.SPOTIFY_ALBUM_REPO_ACCESS_TOKEN }} | |
ALBUM_SHUFFLER_GENERATOR_SOURCE_URL: ${{ vars.SOURCE_URL }} | |
ALBUM_SHUFFLER_GENERATOR_ARTIST_DETAILS_URL: ${{ vars.ARTIST_DETAILS_URL }} | |
ALBUM_SHUFFLER_GENERATOR_ALBUMS_URL: ${{ vars.ALBUMS_URL }} | |
run: | |
./generate-album-data; tree | |
# | |
# Build the actual elm app | |
# | |
- name: Install dependencies | |
run: npm install --production | |
- name: Install uglifyjs | |
run: npm install -g uglify-js | |
- name: Install elm | |
run: npm install -g elm | |
- name: Build project | |
run: elm make src/Main.elm --optimize --output main.js | |
- name: Minify JS | |
run: uglifyjs main.js --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe' | uglifyjs --mangle --output dist/js/main.js | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: dist | |
keep_files: true |