Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
feat: add github actions to deploy this automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
travis committed Jul 20, 2023
1 parent 45fd7bb commit 1a9b88c
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/actions/setup-npm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: setup-npm
description: Setup node and npm

runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version: 18
cache: 'npm'
- run: npm ci
shell: bash
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release
on:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-npm
- run: npm test

changelog:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.tag-release.outputs.releases_created }}
steps:
- uses: google-github-actions/release-please-action@v3
id: tag-release
with:
release-type: node
package-name: access-proxy
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Other Changes","hidden":false}]'

release-staging:
name: staging
environment: staging
concurrency: staging
needs:
- changelog
- test
# deploy staging if not a release, otherwise deploy to prod
if: needs.changelog.outputs.releases_created == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-npm
- uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CF_TOKEN }}
command: deploy --env staging

release-production:
name: production
environment: production
concurrency: production
needs:
- changelog
- test
if: needs.changelog.outputs.releases_created
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-npm
- uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CF_TOKEN }}
command: deploy --env production

0 comments on commit 1a9b88c

Please sign in to comment.