Skip to content

chore: remove old website url and instead use eirik.re (#84) #82

chore: remove old website url and instead use eirik.re (#84)

chore: remove old website url and instead use eirik.re (#84) #82

name: Publisher
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
# pull_request event is required only for autolabeler
# pull_request:
# Only following types are handled by the action, but one can default to all as well
# types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]
permissions:
contents: read
jobs:
update_release_draft:
name: Release
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT
# echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
# Maybe see [this](https://stackoverflow.com/questions/59191913/how-do-i-get-the-output-of-a-specific-step-in-github-actions) on how to set this up properly with env variables.
- name: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/action-detect-and-tag-new-version@v2.0.3
with:
version-command: |
cat current-version.txt
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v6
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
deploy: ${{ steps.check-version.outputs.tag != '' }}
deploy:
name: Deploy to GitHub pages
runs-on: ubuntu-latest
# Only run the deployment if the owner initiated the workflow, if the
# release-drafter ran successfully and if a new version tag was detected.
needs: update_release_draft
if: needs.update_release_draft.outputs.deploy == 'true' && github.actor == github.repository_owner
steps:
- uses: actions/checkout@v4
with:
# persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
token: ${{ secrets.ACCESS_TOKEN }}
- name: Generate static presentations site
uses: actions/setup-node@v4
with:
node-version: '16'
- run: npm ci
- run: npm run build
- name: Init new repo in dist folder and commit generated files
run: |
cd docs/
[[ ${{ github.actor }} == "engeir" ]] && echo "slides.eirik.re" > CNAME
git init
git add -A
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "Add changes"
- name: Force push to destination branch
uses: ad-m/github-push-action@master
with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.ACCESS_TOKEN }}
branch: gh-pages
force: true
directory: ./docs/