Skip to content

cd

cd #43

Workflow file for this run

name: cd
permissions:
contents: write
on:
workflow_run:
workflows: [ci]
branches: [main]
types:
- completed
repository_dispatch:
types: [deploy]
workflow_dispatch:
jobs:
cd:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 23
extra_plugins: |
@semantic-release/changelog@6
@semantic-release/git@10
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
cname: metro-travel.vincenthardouin.dev
- name: Generate Screenshots
id: screenshots
if: steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_patch_version == '0'
run: (npm start &); npm run screenshots && echo "screenshots_generated=true" >> $GITHUB_OUTPUT
- name: Commit & push screenshots
if: steps.screenshots.outputs.screenshots_generated == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected] "
git config --global user.name "Vincent Hardouin"
git add docs
git commit -m "docs: include screenshots for version ${{steps.semantic.outputs.new_release_version}} [skip ci]"
git push https://VincentHardouin:${{ env.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:refs/heads/main