From 06271b52fe93ca7dc553f30e3c5cf9f886a60e96 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 15 Mar 2024 20:59:09 +0100 Subject: [PATCH] feat(ci): release-please --- .github/workflows/main.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17e8c48b..5459a1c7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -243,6 +243,15 @@ jobs: CLUSTER_USER: ${{ secrets.CLUSTER_USER }} CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }} timeout-minutes: 60 + - name: Attach the CAR to release if building a release tag + if: github.event_name == 'release' && github.event.action == 'published' + run: | + curl \ + -XPOST \ + -H "Authorization: Bearer ${{ secrets.UCI_GITHUB_TOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@dist_${{ github.sha }}.car" \ + "https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.get_release.outputs.release_id }}/assets?name=dist_${{ github.event.release.tag_name }}_${{ github.sha }}.car" - name: Update DNSLink at inbrowser.dev (Staging for Dev Testing) if main branch was updated if: (github.event_name == 'workflow_dispatch' || github.event_name == 'push') && github.ref == 'refs/heads/main' run: | @@ -366,7 +375,7 @@ jobs: - cloudflare-ipfs.com steps: - name: Try fetching the new CID as CAR from ${{ matrix.gateway }} - run: curl --retry 6 --retry-delay 61 --retry-all-errors -v -L "https://${{ matrix.gateway }}/ipfs/${{ needs.publish-to-ipfs.outputs.cid }}?format=car" -o dag.car + run: curl --retry 6 --retry-delay 61 --retry-all-errors -v -L --http1.1 "https://${{ matrix.gateway }}/ipfs/${{ needs.publish-to-ipfs.outputs.cid }}?format=car" -o dag.car - uses: ipfs/download-ipfs-distribution-action@v1 with: name: kubo @@ -396,3 +405,19 @@ jobs: - uses: ipfs/start-ipfs-daemon-action@v1 - name: Confirm Kubo can fetch with Routing.Type=${{ matrix.routing-type }} run: ipfs dag stat ${{ needs.publish-to-ipfs.outputs.cid }} + + release-please: + runs-on: ubuntu-latest + if: (github.event_name == 'workflow_dispatch' || github.event_name == 'push') && github.ref == 'refs/heads/main' + needs: [ build, check ] + permissions: + contents: write # to create release + pull-requests: write # to create release PR + steps: + - uses: google-github-actions/release-please-action@v4 + with: + # NOTE: we need elevated PAT token for production DNSLink to be updated. this is because tags created by the default token + # will not trigger CI build, and we need publish-to-ipfs to run when a new release tag is created by this action + # https://github.com/google-github-actions/release-please-action?tab=readme-ov-file#github-credentials + token: ${{ secrets.UCI_GITHUB_TOKEN || github.token }} + release-type: node