feat: update for Oct. 2024 (ESGI) #43
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: Main Workflow | |
on: | |
create: | |
tags: | |
- '*' | |
push: | |
branches-ignore: | |
- gh_pages | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build CV | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@master | |
## Retrieve context to define variables | |
- name: 'Get tag value (if run triggered by a tag)' | |
if: startsWith(github.ref, 'refs/tags/') | |
id: tags | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Get branch name | |
if: startsWith(github.ref, 'refs/heads/') | |
id: branches | |
run: echo ::set-output name=branch::${GITHUB_REF#refs/heads/} | |
- name: 'Build' | |
run: make all | |
- name: Test | |
run: make test | |
- name: 'Upload dist/ as artefact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
# Only run deploy when pushing code on a branch of the repository | |
if: github.event_name == 'push' | |
steps: | |
- name: 'Download dist/ Artefacts' | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
# Deploy | |
- name: 'Deploy Tag (if run triggered by a tag)' | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
destination_dir: ${{ steps.tags.outputs.tag }} | |
keep_files: true | |
- name: 'Deploy Branch (if run triggered by a push to a branch)' | |
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
destination_dir: ${{ steps.branches.outputs.branch }} | |
keep_files: true | |
- name: 'Deploy Principal Branch (if run triggered by a push to the principal branch)' | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
destination_dir: ./ | |
keep_files: true |