diff --git a/.github/workflows/build-test-docs.yml b/.github/workflows/build-test-docs.yml index 76bec3b1..aaef613a 100644 --- a/.github/workflows/build-test-docs.yml +++ b/.github/workflows/build-test-docs.yml @@ -16,6 +16,10 @@ on: description: 'artifact name to write' type: string required: false + latest: + description: 'build the latest release' + type: boolean + required: false jobs: build-docs: @@ -25,12 +29,10 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - uses: actions/checkout@v3 # check out this repo - if: ${{ !inputs.ref }} - - uses: actions/checkout@v3 # check out the repo we're building docs for - if: ${{ inputs.ref }} + + - uses: actions/checkout@v3 with: - ref: ${{ inputs.ref }} + ref: ${{ inputs.ref || github.ref }} - uses: actions/checkout@v3 with: repository: bdunderscore/modular-avatar-images diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 3e91dcd5..9bb89c7e 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -17,17 +17,23 @@ concurrency: cancel-in-progress: true jobs: + get_latest_release: + name: Get latest release + uses: bdunderscore/modular-avatar/.github/workflows/get-latest-release.yml@main + build-docs: - name: Build documentation + name: Build documentation (latest release) + needs: + - get_latest_release + uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main + with: + ref: ${{ needs.get_latest_release.outputs.latest_release_tag }} + + build-docs-dev: + name: Build documentation (main branch) uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main with: ref: main - - build-docs-dev: - name: Build documentation (dev branch) - uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main - with: - ref: dev path: dev artifact: docs-dev deploy-docs: diff --git a/.github/workflows/get-latest-release.yml b/.github/workflows/get-latest-release.yml new file mode 100644 index 00000000..0f683fc0 --- /dev/null +++ b/.github/workflows/get-latest-release.yml @@ -0,0 +1,23 @@ +# This is isolated to its own workflow file to avoid leaking publish secrets into the +# github token +name: Get latest release +on: + workflow_call: + outputs: + latest_release_tag: + description: 'latest release tag' + value: ${{ jobs.get_latest_release.outputs.latest_release_tag }} +jobs: + get_latest_release: + name: Get latest release + runs-on: ubuntu-latest + steps: + - uses: pozetroninc/github-action-get-latest-release@v0.7.0 + id: latest_release + with: + repository: bdunderscore/modular-avatar + token: ${{ secrets.GITHUB_TOKEN }} + excludes: "prerelease, draft" + - run: echo "latest_release_tag=${{ steps.latest_release.outputs.release }}" + outputs: + latest_release_tag: ${{ steps.latest_release.outputs.release }} \ No newline at end of file