From 5ce6e059000022d5982b525fe02e49ca83f4ed03 Mon Sep 17 00:00:00 2001 From: Henrique Pinheiro Date: Thu, 26 Oct 2023 14:54:18 -0300 Subject: [PATCH 1/3] feat(deploy): Adiciona staging deploys --- .github/workflows/deno-deploy-staging.yml | 58 +++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/deno-deploy-staging.yml diff --git a/.github/workflows/deno-deploy-staging.yml b/.github/workflows/deno-deploy-staging.yml new file mode 100644 index 0000000..dc8d603 --- /dev/null +++ b/.github/workflows/deno-deploy-staging.yml @@ -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' + }) \ No newline at end of file From d4b162e79b3b98f72c888018b198d9dbcb40d94e Mon Sep 17 00:00:00 2001 From: Henrique Pinheiro Date: Thu, 26 Oct 2023 15:38:55 -0300 Subject: [PATCH 2/3] feat(deploy): Usa cache no prod deploy --- .github/workflows/deno-deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/deno-deploy.yml b/.github/workflows/deno-deploy.yml index 745a08f..dda258b 100644 --- a/.github/workflows/deno-deploy.yml +++ b/.github/workflows/deno-deploy.yml @@ -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 From 5de5c3f75b3f2185ac66d0e50c7daebbd8e80c32 Mon Sep 17 00:00:00 2001 From: Henrique Pinheiro Date: Thu, 26 Oct 2023 15:39:12 -0300 Subject: [PATCH 3/3] chore(cleanup): Remove extranous yarn.lock --- yarn.lock | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 yarn.lock diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index fb57ccd..0000000 --- a/yarn.lock +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - -