-
Notifications
You must be signed in to change notification settings - Fork 48
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
b601d82
commit bf39cd8
Showing
3 changed files
with
81 additions
and
3 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
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
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,77 @@ | ||
name: Deploy to production environment | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
install: | ||
type: string | ||
required: false | ||
default: npm ci | ||
build: | ||
type: string | ||
required: false | ||
default: npm run build | ||
output_dir: | ||
type: string | ||
required: false | ||
default: public/ | ||
node_version: | ||
type: number | ||
required: true | ||
default: 20 | ||
environment: | ||
type: string | ||
required: false | ||
default: github-pages | ||
secrets: | ||
gh_token: | ||
required: false | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout default branch | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "${{inputs.node_version}}" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install dependencies | ||
run: ${{ inputs.install }} | ||
|
||
- name: Build | ||
run: ${{ inputs.build }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.gh_token }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
name: github-pages | ||
path: ${{ inputs.output_dir }} | ||
|
||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: ${{ inputs.environment }} | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
with: | ||
preview: false |