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

101 lines
2.3 KiB
YAML
Raw Normal View History

2022-05-02 13:59:11 +00:00
name: Deploying
2021-07-13 22:31:37 +00: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 13:10:58 +00:00
node-version: 16
2021-07-13 22:31:37 +00:00
2021-07-13 22:33:02 +00:00
- name: Install Yarn packages
run: yarn install
2021-07-13 22:31:37 +00: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 18:19:24 +00:00
path: ./dist
2022-05-02 13:59:11 +00:00
2021-07-13 22:31:37 +00:00
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
2022-12-27 13:40:43 +00:00
2021-07-13 22:31:37 +00:00
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
2022-12-18 18:19:24 +00:00
path: ./dist
2022-12-27 16:26:14 +00:00
- name: Insert config
env:
DEPLOY_CONFIG: ${{ secrets.DEPLOY_CONFIG }}
2022-12-27 16:35:07 +00:00
run: echo "$DEPLOY_CONFIG" > ./dist/config.js
2022-12-27 16:26:14 +00:00
2021-07-13 22:31:37 +00:00
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2022-12-18 18:19:24 +00:00
publish_dir: ./dist
2022-05-02 13:59:11 +00:00
cname: movie.squeezebox.dev
2022-12-27 13:40:43 +00:00
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
2022-12-27 13:45:26 +00:00
- name: Checkout code
uses: actions/checkout@v2
2022-12-27 13:40:43 +00:00
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: production-files
path: ./dist
- name: Zip files
2022-12-27 13:58:54 +00:00
run: cd dist && zip -r ../movie-web.zip .
2022-12-27 13:40:43 +00: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 13:41:47 +00: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 13:52:27 +00:00
asset_name: movie-web.zip
2022-12-27 13:41:47 +00:00
asset_content_type: application/zip