From da67b863677690612fa1fa59435317949d3d1dc7 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 12 Aug 2023 19:23:19 -0400 Subject: [PATCH] ci: setup --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..619a67a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: Build/Publish + +on: + push: + branches: + - master + - develop + - develop-* + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + 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 + + - name: Set up S3CMD + uses: s3-actions/s3cmd@v1.5.0 + with: + provider: cloudflare + account_id: ${{ secrets.CF_ACCOUNT_ID }} + access_key: ${{ secrets.S3_ACCESS_KEY }} + secret_key: ${{ secrets.S3_SECRET_KEY }} + - name: Publish to S3 Dev + if: ${{ github.ref_name == 'develop' }} + run: sync "dist/" s3://${{ vars.S3_BUCKET_DEV }}/" + - name: Publish to S3 Prod + if: ${{ github.ref_name == 'master' }} + run: sync "dist/" s3://${{ vars.S3_BUCKET }}/" + - 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