Skip to content

Commit

Permalink
GitHub Action Deploy GH Pages (#698)
Browse files Browse the repository at this point in the history
* Feature/gh pages workflow (#680)

* Add workflow

* add change to index for test

* change build to production.

* remove header

* change node version

* change install method to yarn

* chore: Update GitHub Pages deployment workflow

* refactor: Enhance GitHub Actions workflow for building and deploying to GitHub Pages

---------

Co-authored-by: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com>
Co-authored-by: Hilmar Maier <hilmar_maier@fws.gov>
  • Loading branch information
3 people authored Jan 28, 2025
1 parent 40149da commit 8c2e93a
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/gh-pages-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install Dependencies
run: yarn install

- name: Build
run: yarn build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
path: dist

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-output
path: dist

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist

- name: Create Tag
id: create_tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Read version from package.json
version=$(node -p "require('./package.json').version")
version_tag="v$version"
echo "Version from package.json: $version_tag"
echo "version=$version_tag" >> $GITHUB_OUTPUT
git tag $version_tag
git push origin $version_tag
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.create_tag.outputs.version }}
name: Release ${{ steps.create_tag.outputs.version }}
body: Automated release for version ${{ steps.create_tag.outputs.version }}.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8c2e93a

Please sign in to comment.