-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01e1f38
commit da78ba7
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
outputs: | ||
artifact-name: | ||
value: ${{ jobs.build.outputs.artifact-name }} | ||
secrets: | ||
NPM_FONTAWESOME_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
build: | ||
name: Build for ${{ inputs.environment }} | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
|
||
outputs: | ||
artifact-name: build-${{ inputs.environment }}-${{ github.run_id }}-${{ github.run_number }} | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node 21 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
cache: npm | ||
|
||
- name: Install NPM dependencies | ||
# Skip post-install scripts for now to prevent token theft | ||
run: | | ||
npm config set '//npm.fontawesome.com/:_authToken' '${NPM_FONTAWESOME_TOKEN}' | ||
npm ci --ignore-scripts | ||
npm config delete '//npm.fontawesome.com/:_authToken' | ||
env: | ||
NPM_FONTAWESOME_TOKEN: ${{ secrets.NPM_FONTAWESOME_TOKEN }} | ||
|
||
- name: Run post-install scripts | ||
run: npm rebuild | ||
|
||
- name: Build project | ||
run: npm run build | ||
|
||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-${{ inputs.environment }}-${{ github.run_id }}-${{ github.run_number }} | ||
path: dist | ||
retention-days: 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Deploy to Cloudflare Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: deploy | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
environment: Production | ||
secrets: inherit | ||
|
||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: Production | ||
needs: build | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ needs.build.outputs.artifact-name }} | ||
path: dist | ||
|
||
- name: Publish to Cloudflare Pages | ||
uses: cloudflare/pages-action@v1 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | ||
projectName: taco-tapper | ||
branch: main | ||
directory: dist |