movie-web/.github/workflows/deploying.yml

101 lines
2.3 KiB
YAML
Raw Normal View History

2022-05-02 15:59:11 +02:00
name: Deploying
2021-07-14 00:31:37 +02:00
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
2022-05-02 15:10:58 +02:00
node-version: 16
2021-07-14 00:31:37 +02:00
2021-07-14 00:33:02 +02:00
- name: Install Yarn packages
run: yarn install
2021-07-14 00:31:37 +02:00
- name: Build project
run: npm run build
- name: Upload production-ready build files
uses: actions/upload-artifact@v2
with:
name: production-files
2022-12-18 19:19:24 +01:00
path: ./dist
2022-05-02 15:59:11 +02:00
2021-07-14 00:31:37 +02:00
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
2022-12-27 14:40:43 +01:00
2021-07-14 00:31:37 +02:00
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
2022-12-18 19:19:24 +01:00
path: ./dist
2022-12-27 17:26:14 +01:00
- name: Insert config
env:
DEPLOY_CONFIG: ${{ secrets.DEPLOY_CONFIG }}
run: cat "$DEPLOY_CONFIG" > ./dist/config.js
2022-12-27 17:26:14 +01:00
2021-07-14 00:31:37 +02:00
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2022-12-18 19:19:24 +01:00
publish_dir: ./dist
2022-05-02 15:59:11 +02:00
cname: movie.squeezebox.dev
2022-12-27 14:40:43 +01:00
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
2022-12-27 14:45:26 +01:00
- name: Checkout code
uses: actions/checkout@v2
2022-12-27 14:40:43 +01:00
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
path: ./dist
- name: Zip files
2022-12-27 14:58:54 +01:00
run: cd dist && zip -r ../movie-web.zip .
2022-12-27 14:40:43 +01:00
- name: Get version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package-version.outputs.current-version }}
release_name: Movie web v${{ steps.package-version.outputs.current-version }}
draft: false
prerelease: false
- name: Upload Release Asset
2022-12-27 14:41:47 +01:00
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./movie-web.zip
2022-12-27 14:52:27 +01:00
asset_name: movie-web.zip
2022-12-27 14:41:47 +01:00
asset_content_type: application/zip