-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitHub Action Deploy GH Pages (#698)
* 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
1 parent
40149da
commit 8c2e93a
Showing
1 changed file
with
71 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,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 }} |