Skip to content

Deploy (production) #225

Deploy (production)

Deploy (production) #225

name: Deploy (production)
on:
workflow_dispatch:
push:
branches:
- production
jobs:
deploy:
name: Deploy
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
ref: production
- name: Setup Node
uses: actions/[email protected]
with:
node-version-file: ./.node-version
cache: 'yarn'
- name: Install deps
run: yarn install --frozen-lockfile --prefer-offline
- name: Test
run: yarn run test
- name: Generate
run: yarn run generate:deploy
- name: Deploy
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
publish_branch: prod-deploy
- name: Create GitHub release
uses: rymndhng/release-on-push-action@master
continue-on-error: true
with:
bump_version_scheme: patch
ogp_build:
name: OGP Build
needs: deploy
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: prod-deploy
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
working-directory: ui-test
- name: Take screenshot
run: (python -m http.server --directory ./ 8000 &) ; python ./ui-test/ogp_screenshot.py
- name: Upload screenshot
uses: actions/upload-artifact@v3
with:
name: ogp
path: ogp
ogp_upload:
name: OGP Upload
needs: ogp_build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: prod-deploy
- name: Download ogp images
uses: actions/download-artifact@v3
with:
name: ogp
path: ogp
- name: Compress Images
uses: calibreapp/image-actions@main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
compressOnly: true
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions"
git add ogp
git commit -m "Add OGP changes"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: prod-deploy
# tweet:
# runs-on: ubuntu-22.04
# needs: deploy
# steps:
# - name: Checkout production branch
# uses: actions/checkout@v3
# with:
# ref: production
# - name: Set up Python 3.10
# uses: actions/setup-python@v4
# with:
# python-version: '3.10'
# cache: 'pip'
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
# working-directory: auto-tweet
# - name: Sleep 5min (waiting for Netlify deploy)
# run: sleep 5m
# - name: Tweet as @Covid19_ibaraki & Retweet as @a01sa01to
# env:
# API_KEY: ${{ secrets.TWITTER_API_KEY }}
# API_SECRET: ${{ secrets.TWITTER_API_SECRET }}
# ACCESS_SECRET: ${{ secrets.TWITTER_ACCESS_SECRET_SCI }}
# ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN_SCI }}
# run: python auto-tweet/tweet.py