Publish Website #374
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: "Publish Website" | |
on: | |
schedule: | |
- cron: '0 2,14 * * *' | |
workflow_dispatch: | |
jobs: | |
publish-code: | |
runs-on: ubuntu-latest | |
steps: | |
# See documentation for the action | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.GIT_SSH_KEY }} | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
if_key_exists: fail | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ictunion/main-website | |
fetch-depth: 0 | |
ref: main | |
ssh-key: ${{ secrets.GIT_SSH_KEY }} | |
ssh-known-hosts: ${{ secrets.KNOWN_HOSTS }} | |
- name: Install nix | |
uses: cachix/install-nix-action@v18 | |
- name: Create anonymized repo | |
run: nix run github:ictunion/git-anonymize -- . -o /tmp/anonymized -n 'ICT Guerrilla' -e 'ictguerrilla@proton.me' -r HEAD production | |
- name: Publish anonymized repository | |
working-directory: /tmp/anonymized | |
run: | | |
git checkout main | |
git remote add origin git@github.com:ictunion/main-website-public.git | |
git push --force origin main | |
git push origin production:production --force | |
deploy-testing: | |
needs: publish-code | |
runs-on: ubuntu-latest | |
steps: | |
# See documentation for the action | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.GIT_SSH_KEY }} | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
if_key_exists: fail | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ictunion/main-website-public | |
ref: main | |
ssh-key: ${{ secrets.GIT_SSH_KEY }} | |
ssh-known-hosts: ${{ secrets.KNOWN_HOSTS }} | |
- name: Install nix | |
uses: cachix/install-nix-action@v18 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Current time | |
run: date +%c | |
- name: Build website | |
run: nix build | |
- name: Deploy main to testing | |
run: | | |
nix-shell -p rsync --run 'rsync -rt result/var website@ictunion.cz:/home/website/testing' | |
deploy-production: | |
needs: publish-code | |
runs-on: ubuntu-latest | |
steps: | |
# See documentation for the action | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.GIT_SSH_KEY }} | |
known_hosts: ${{ secrets.KNOWN_HOSTS }} | |
if_key_exists: fail | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ictunion/main-website-public | |
ref: production | |
ssh-key: ${{ secrets.GIT_SSH_KEY }} | |
ssh-known-hosts: ${{ secrets.KNOWN_HOSTS }} | |
- name: Install nix | |
uses: cachix/install-nix-action@v18 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Current time | |
run: date +%c | |
- name: Build website | |
run: nix build | |
- name: Deploy production tag to production | |
run: | | |
nix-shell -p rsync --run 'rsync -rt result/var website@ictunion.cz:/home/website/production' |