Merge pull request #15 from paulipotter/dependabot/github_actions/dot… #63
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: ci-cd | |
on: | |
[pull_request, push, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: Install dependencies 🛠 | |
run: | | |
if [ -e yarn.lock ]; then | |
yarn install --frozen-lockfile | |
elif [ -e package-lock.json ]; then | |
npm ci | |
else | |
npm i | |
fi | |
- name: Build Jekyll for GitHub Pages 👷🏻♀️ | |
uses: actions/[email protected] | |
with: | |
source: ./ | |
destination: ./_site | |
future: true | |
build_revision: ${{ github.sha }} | |
verbose: true | |
token: ${{ github.token }} | |
- name: Upload GitHub Pages artifact 📦 | |
uses: actions/[email protected] | |
get-artifact: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Download Artifact 👾 | |
uses: actions/[email protected] | |
- name: Display structure of downloaded files | |
run: ls -R | |
deploy: | |
# Use branch name for whatever purpose | |
needs: [get-artifact, build] | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Get branch name | |
run: echo 'The branch name is' $BRANCH_NAME | |
- name: Deploy GitHub Pages site 🌎 | |
id: deployment | |
uses: actions/[email protected] | |