lumeweb.com/.github/workflows/ci.yml

63 lines
2.2 KiB
YAML
Raw Normal View History

2023-08-12 23:23:19 +00:00
name: Build/Publish
on:
push:
branches:
- master
- develop
- develop-*
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
2023-08-13 01:24:14 +00:00
env:
RCLONE_CONFIG_S3_TYPE: s3
RCLONE_CONFIG_S3_PROVIDER: Cloudflare
RCLONE_CONFIG_S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
RCLONE_CONFIG_S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
RCLONE_CONFIG_S3_ENDPOINT: ${{ secrets.CF_ACCOUNT_ID }}.r2.cloudflarestorage.com
2023-08-12 23:23:19 +00:00
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
env:
NODE_OPTIONS: "--max_old_space_size=4096"
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GITEA_SSH_KEY }}
known_hosts: ${{ secrets.GITEA_KNOWN_HOST }}
- name: Publish
run: npm run semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Clean Up Robots Dev
if: ${{ github.ref_name == 'develop' }}
run: mv dist/robots-dev.txt dist/robots.txt
- name: Clean Up Robots Prod
if: ${{ github.ref_name == 'master' }}
run: rm dist/robots-dev.txt
2023-08-13 01:24:14 +00:00
- name: Setup RClone
run: curl https://rclone.org/install.sh | sudo bash -s
2023-08-12 23:23:19 +00:00
- name: Publish to S3 Dev
if: ${{ github.ref_name == 'develop' }}
2023-08-13 01:24:14 +00:00
run: rclone sync dist/ s3:${{ vars.S3_BUCKET_DEV }}/
2023-08-12 23:23:19 +00:00
- name: Publish to S3 Prod
if: ${{ github.ref_name == 'master' }}
2023-08-13 01:24:14 +00:00
run: rclone sync dist/ s3:${{ vars.S3_BUCKET }}/
2023-08-12 23:23:19 +00:00
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled && failure() }}
with:
limit-access-to-actor: true