Skip to content

Commit

Permalink
Reusable publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
logius-standaardenbeheer authored and sanderke committed Jan 19, 2024
1 parent 6e60389 commit da7e8d2
Showing 1 changed file with 20 additions and 78 deletions.
98 changes: 20 additions & 78 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,20 @@
name: Build and Check
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
build:
name: Build
uses: Logius-standaarden/Automatisering/.github/workflows/build.yml@main
check:
needs: build
name: Check
uses: Logius-standaarden/Automatisering/.github/workflows/check.yml@main

release:
needs: build
name: Release
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push'}}
steps:
- uses: actions/checkout@v2
- name: Recover HTML
uses: actions/cache@v2
with:
path: ~/static
key: ${{ github.run_id }}
- name: Gather files
run: |
rm -f *.md *.html
mv ~/static/snapshot.html index.html
mkdir content
shopt -s extglob
mv !(content) content
git clone https://user:${{ secrets.BEHEER }}@github.com/Logius-standaarden/publicatie.git
- name: Commit release
run: |
wget https://raw.githubusercontent.com/Logius-standaarden/Automatisering/main/scripts/release.py
python release.py
cd publicatie
git add -A
git config user.name "GitHub Action"
git config user.email "[email protected]"
git commit -m "Release: ${{ github.event.repository.name }}"
git push
preview:
needs: build
name: Preview
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v2
- name: Recover HTML
uses: actions/cache@v2
with:
path: ~/static
key: ${{ github.run_id }}
- name: Gather files
run: |
rm index.html
mv ~/static/snapshot.html index.html
rm -f *.md *.pdf *.js snapshot.html
mkdir ~/content
mv ./* ~/content
git clone https://user:${{ secrets.BEHEER }}@github.com/Logius-standaarden/Publicatie-Preview.git
- name: Commit preview
run: |
cd Publicatie-Preview
rm -f -r ${{ github.event.repository.name }}/${{ github.head_ref }}
mkdir -p ${{ github.event.repository.name }}/${{ github.head_ref }}
mv ~/content/* ${{ github.event.repository.name }}/${{ github.head_ref }}
git add -A
git config user.name "GitHub Action"
git config user.email "[email protected]"
git commit -m "new preview build"
git push
name: Build and Check
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
build:
name: Build
uses: Logius-standaarden/Automatisering/.github/workflows/build.yml@main
check:
needs: build
name: Check
uses: Logius-standaarden/Automatisering/.github/workflows/check.yml@main
publish:
needs: build
name: Publish (Logius)
uses: Logius-standaarden/Automatisering/.github/workflows/publish.yml@main
secrets: inherit

0 comments on commit da7e8d2

Please sign in to comment.