Add website intro #76
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
name: Generate files | |
on: | |
push: | |
branches-ignore: | |
- 'gh-pages' | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
generate-files: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- run: echo "The ${{ github.repository }} repository has been cloned to the runner." | |
- name: Generate the files in docker | |
run: scripts/run.sh | |
- run: ls scripts/dist/ -lh | |
- name: Deploy ssh key | |
if: ${{ github.ref_name == 'master' && github.repository == 'OSGeo/spatialreference.org' }} | |
shell: bash -l {0} | |
run: | | |
mkdir $HOME/.ssh && echo "${{ secrets.SSH_PRIVATE_KEY }}" > $HOME/.ssh/id_rsa | |
chmod 700 $HOME/.ssh && chmod 600 $HOME/.ssh/id_rsa | |
ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts | |
eval `ssh-agent -s` | |
ssh-add $HOME/.ssh/id_rsa | |
- name: Deploy to gh-pages | |
if: ${{ github.ref_name == 'master' && github.repository == 'OSGeo/spatialreference.org' }} | |
shell: bash -l {0} | |
run: | | |
set -x | |
set -e | |
cd scripts/dist/ | |
git init | |
git checkout -b gh-pages | |
git remote add origin [email protected]:OSGeo/spatialreference.org.git | |
git config user.email "[email protected]" | |
git config user.name "spatialreference.org deploybot" | |
touch .nojekyll | |
echo "spatialreference.org" > CNAME | |
git add -A | |
git commit -m "update with results of commit ${{ github.sha }}" | |
git push -f origin gh-pages | |
- name: Deploy ssh key for scratch site (pull request) | |
if: ${{ github.event_name == 'pull_request' && github.ref_name != 'master' && github.repository == 'OSGeo/spatialreference.org' }} | |
shell: bash -l {0} | |
run: | | |
sudo apt install hxtools | |
mkdir $HOME/.ssh | |
# Note: this is obviously unsecure !!! But we don't mind if the content of sr-org-scratch/sr-org-scratch is "compromised" | |
cat .github/workflows/some_secret.txt | rot13 > $HOME/.ssh/id_rsa | |
chmod 700 $HOME/.ssh && chmod 600 $HOME/.ssh/id_rsa | |
ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts | |
eval `ssh-agent -s` | |
ssh-add $HOME/.ssh/id_rsa | |
- name: Deploy HTML pages to scratch site (pull request) | |
if: ${{ github.event_name == 'pull_request' && github.ref_name != 'master' && github.repository == 'OSGeo/spatialreference.org' }} | |
shell: bash -l {0} | |
run: | | |
set -x | |
set -e | |
cd scripts/dist/ | |
git init | |
git remote add origin [email protected]:sr-org-scratch/sr-org-scratch.github.io.git | |
git config user.email "[email protected]" | |
git config user.name "spatialreference.org deploybot" | |
touch .nojekyll | |
echo "User-agent: * Disallow: /" > robots.txt | |
git add -A | |
git commit -m "update with results of commit ${{ github.sha }}" | |
git push -f origin master |