Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deploy): Adiciona staging deploys #24

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/deno-deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deno Deploy (Staging)
on:
pull_request:
paths: ['web/**', '.github/workflows/deno-deploy-staging.yml']

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
pull-requests: write

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Setup node and cache
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
cache-dependency-path: web/yarn.lock

- name: Install dependencies
working-directory: ./web
run: yarn

- name: Build Astro
working-directory: ./web
env:
MONGO_URI: ${{secrets.MONGO_URI}}
run: yarn run build

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install deployctl
run: deno install --allow-all --no-check -r -f https://deno.land/x/deploy/deployctl.ts

- id: deploy
name: Upload to Deno Deploy
working-directory: ./web
run: |
cd dist
echo "staging_hash=$(deployctl deploy --project=${{secrets.DENO_DEPLOY_PROJECT}} --token=${{secrets.DENO_DEPLOY_TOKEN}} ./server/entry.mjs | awk -F'[-.]' '/deno.dev/{print $3}')" >> $GITHUB_OUTPUT

- uses: actions/github-script@v6
name: Adiciona comentário
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Disponível em https://dwca2json-${{steps.deploy.outputs.staging_hash}}.deno.dev'
})
8 changes: 8 additions & 0 deletions .github/workflows/deno-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ jobs:
permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
pull-requests: write

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Setup node and cache
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
cache-dependency-path: web/yarn.lock

- name: Install dependencies
working-directory: ./web
run: yarn
Expand Down
4 changes: 0 additions & 4 deletions yarn.lock

This file was deleted.