deploy with github pages #31
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: release-publish | |
on: | |
push: | |
branches: [ "master" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Install elm | |
uses: JorelAli/setup-elm@v2 | |
with: | |
elm-version: 0.19.1 | |
- name: Install nodejs | |
uses: actions/setup-node@v2 | |
- name: Install uglify | |
run: npm install uglify-js | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: build artifacts | |
run: | | |
mkdir -p ./build | |
cp -a ./assets/. ./build/ | |
sed -i "s/DEV/$RELEASE_VERSION/" ./build/index.html | |
elm make --optimize --output=./build/premain.js src/Main.elm | |
./node_modules/.bin/uglifyjs ./build/premain.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" | ./node_modules/.bin/uglifyjs --mangle --output ./build/main.js | |
rm ./build/premain.js | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: './build' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
# - name: Upload S3 | |
# uses: jakejarvis/s3-sync-action@master | |
# with: | |
# args: --acl public-read --follow-symlinks --delete | |
# env: | |
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET }} | |
# AWS_S3_BUCKET: ${{ secrets. AWS_S3_BUCKET }} | |
# AWS_REGION: 'eu-central-1' | |
# SOURCE_DIR: 'build' |