Merge branch 'main' of https://github.com/devhatt/blog #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pipeline | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # to create release | |
issues: write # to post issue comments | |
pull-requests: write # to create pull request | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_VERSION: 18.18.2 | |
STORE_PATH: .pnpm-store | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v3 | |
- name: Setup deps | |
uses: ./.github/actions/install-deps | |
- name: Create Release Pull Request | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
# This expects you to have a script called release which does a build for your packages and calls changeset publish | |
publish: pnpm ci:publish | |
version: pnpm ci:version | |
title: "Publish new contents to production!" | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
build: | |
needs: release | |
runs-on: ubuntu-latest | |
if: needs.release.outputs.published == 'true' | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v3 | |
- name: Setup deps | |
uses: ./.github/actions/install-deps | |
- name: Build | |
run: pnpm generate | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./.output/plubic | |
deploy: | |
# Add a dependency to the build job | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github_pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |