Track contributors per-extension-path, not per repo #1085
Workflow file for this run
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: Gatsby Publish | |
on: | |
push: | |
branches: | |
[ main ] | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
schedule: ## Do a run twice daily, to refresh website content | |
- cron: '0 22,04 * * *' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: "npm" # this only caches global dependencies | |
- run: npm ci --prefer-offline | |
- run: npm run test | |
env: | |
CI: true | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get current date | |
id: date | |
run: | | |
echo "month=$(date +'%Y-%m')" >> "$GITHUB_OUTPUT" | |
echo "day=$(date +'%d')" >> "$GITHUB_OUTPUT" | |
- name: Restoring cached GitHub API results | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.cache-github-api | |
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }} | |
restore-keys: | # If there are multiple partial matches for a restore key, the action returns the most recently created cache. | |
gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }} | |
gatsby-build-github-queries- | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: "npm" # this only caches global dependencies | |
- run: npm ci --prefer-offline | |
- run: npm run build -- ${{ github.ref_name == 'main' && '--prefix-paths' || '' }} | |
env: | |
NODE_ENV: production | |
GATSBY_ACTIVE_ENV: production | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY }} | |
- name: Caching GitHub API results | |
uses: actions/cache/save@v3 # save the cache even if the integration tests fail | |
with: | |
path: | | |
.cache-github-api | |
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }} | |
- run: npm run test:int | |
env: | |
CI: true | |
PATH_PREFIX: "${{ github.ref_name == 'main' && 'extensions' || '' }}" | |
PATH_PREFIX_FLAG: "${{ github.ref_name == 'main' && '--prefix-paths' || '' }}" | |
- name: Store PR id | |
if: "github.event_name == 'pull_request'" | |
run: echo ${{ github.event.number }} > ./public/pr-id.txt | |
- name: Publishing directory for PR preview | |
uses: actions/upload-artifact@v3 | |
with: | |
name: site | |
path: ./public | |
retention-days: 3 | |
deploy: | |
# Only try and deploy on merged code | |
if: "github.repository == 'quarkusio/extensions' && github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule')" | |
needs: [ unit-test, build ] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 # not needed for the code, but needed for the git config | |
- name: Download Built site | |
uses: actions/download-artifact@v3 | |
with: | |
name: site | |
path: site | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: site # The folder the action should deploy. | |
branch: pages |