Skip to content
name: Build Release Deploy production 🚀
on:
push:
branches: [production]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
cache: "npm"
- name: Install dependencies 🔧
run: npm install
- name: Build 🏭
run: |
mkdir -v dist
npm run build
sed -i "s/dev3000/eventInfo/" dist/settings.js
sed -i "s/evento.ch/eventoapp.apps.be.ch/" dist/settings.js
sed -i "s/evento.ch/eventoapp.apps.be.ch/" dist/settings.js
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
target-folder: dist
# build the zip to upload to release
- name: Build zip
run: |
cp -r dist release
cd release && mv settings.js settings.js.example
zip --recurse-paths event-information.zip *
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
## Create Release
- name: Create Release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.event.head_commit.message }}
release_name: V${{ github.event.head_commit.message }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./release/event-information.zip
asset_name: event-information.zip
asset_content_type: application/zip