v1.8.2 #16
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: "Publish :: Release" | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
tag: | |
type: string | |
required: true | |
description: "The tag to publish" | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Get release" | |
id: get_release | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
uses: bruceadams/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
- name: "Resolve version" | |
id: resolve_version | |
shell: bash | |
run: | | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
echo ::set-output name=version::${{ github.event.inputs.tag }} | |
else | |
echo ::set-output name=version::${{ steps.get_release.outputs.tag_name }} | |
fi | |
- name: "Checkout personal-webapp" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ steps.resolve_version.outputs.version }} | |
path: ${{ github.workspace }}/personal-webapp | |
- name: "Checkout caponetto.github.io" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
path: ${{ github.workspace }}/caponetto.github.io | |
token: ${{ secrets.TOKEN }} | |
repository: caponetto/caponetto.github.io | |
- name: "Setup environment" | |
uses: ./personal-webapp/.github/actions/setup-env | |
with: | |
path: personal-webapp | |
- name: "Build" | |
working-directory: ${{ github.workspace }}/personal-webapp | |
env: | |
GTM_ID: "GTM-TX4N6TH" | |
VERSION: ${{ steps.resolve_version.outputs.version }} | |
shell: bash | |
run: | | |
yarn build:prod | |
- name: "Deploy to GitHub Pages (caponetto.github.io)" | |
working-directory: ${{ github.workspace }}/caponetto.github.io | |
shell: bash | |
run: | | |
echo "Reset deployment dir" | |
shopt -s extglob | |
rm -rf -- !(".well-known"|"poc"|".nojekyll"|"LICENSE"|"README.md"|"_config.yml"|"CNAME") | |
echo "Copy resources" | |
cp -r ${{ github.workspace }}/personal-webapp/dist/* . | |
echo "Commit changes and push" | |
git add . | |
git commit -m "Deploy ${{ steps.resolve_version.outputs.version }}" || echo "No changes." | |
git push origin main |