Bump actions/download-artifact from 1 to 4.1.7 in /.github/workflows #111
Workflow file for this run
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
# https://help.github.com/en/articles/workflow-syntax-for-github-actions | |
name: Build | |
on: | |
push: | |
paths-ignore: | |
- '**.html' # HTML is auto generated by this workflow. | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
name: Generate HTML documents | |
steps: | |
- uses: actions/checkout@v1 | |
# Setup ldap2html | |
- uses: actions/checkout@v1 | |
with: | |
repository: nonylene/ldap2html | |
ref: refs/heads/master | |
path: ldap2html | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
- run: pip3 install ldap2html | |
# Setup OpenLDAP | |
- name: Run OpenLDAP background | |
run: docker run -p 127.0.0.1:389:389 -v ${GITHUB_WORKSPACE}:/repo -v ${GITHUB_WORKSPACE}/../ldap2html/schema:/container/service/slapd/assets/config/bootstrap/ldif/custom --rm --env LDAP_DOMAIN="ku-ldif.github.io" -d --name ldap osixia/openldap:1.3.0 --copy-service | |
- run: sleep 10 # Wait until openldap boot | |
- name: Add ldap entries | |
run: | | |
for f in src/*.html.ldif; do # sorted | |
docker exec ldap ldapadd -x -H ldap://localhost -D "cn=admin,dc=ku-ldif,dc=github,dc=io" -w admin -f /repo/$f | |
done | |
- name: Modify ldap entries | |
run: | | |
for f in src/modify/*.html.ldif; do # sorted | |
docker exec ldap ldapmodify -x -H ldap://localhost -D "cn=admin,dc=ku-ldif,dc=github,dc=io" -w admin -f /repo/$f | |
done | |
- name: ldapsearch for debug | |
run: docker exec ldap ldapsearch -x -H ldap://localhost -D "cn=admin,dc=ku-ldif,dc=github,dc=io" -b "dc=ku-ldif,dc=github,dc=io" -w admin | |
- name: Generate html files | |
run: ldap2html -H ldap://localhost -b 'dc=ku-ldif,dc=github,dc=io' -D 'cn=admin,dc=ku-ldif,dc=github,dc=io' -w admin -v | |
working-directory: ../ldap2html | |
- run: docker stop ldap | |
- name: Upload artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: out | |
path: ../ldap2html/out/html | |
deploy: | |
if: github.ref == 'refs/heads/master' | |
needs: [generate] | |
name: Deploy (Update repository) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup git | |
run: | | |
git config --local user.email "ku-ldif@users.noreply.github.com" | |
git config --local user.name "ku-ldif" | |
git fetch origin gh-pages | |
git checkout -b gh-pages origin/gh-pages | |
- uses: actions/download-artifact@v4.1.7 | |
with: | |
name: out | |
- run: | | |
find . -path ./out -prune -o -name '*.html' -print | xargs rm | |
cp -a out/* ./ | |
rm -r out | |
- name: Git commit and push if diff exists | |
run: | | |
find . -name '*.html' | xargs git add | |
if ! git diff --staged --quiet; then | |
git commit -m "[auto] Generate HTML documents" | |
git push https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/ku-ldif/ku-ldif.github.io.git HEAD:gh-pages | |
fi |