updates #208
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: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
concurrency: | |
group: "cicd" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
- name: Get Build Time | |
run: echo "TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
ghcr.io/ezrizhu/www:${{ github.sha }} | |
ghcr.io/ezrizhu/www:latest | |
build-args: | | |
COMMIT=${{ github.sha }} | |
REF=${{ github.ref }} | |
TIME=${{ env.TIME }} | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger www0 to update | |
run: ${{ secrets.WTWWW0 }} | |
- name: Deployment Grace Period | |
run: sleep 5 | |
- name: Ensure that www0 is updated | |
run: 'curl -H "X-Server-Select: www0" https://ezrizhu.com | grep ${{ github.sha }}' | |
- name: Trigger www1 to update | |
run: ${{ secrets.WTWWW1 }} | |
- name: Deployment Grace Period | |
run: sleep 5 | |
- name: Ensure that www1 is updated | |
run: 'curl -H "X-Server-Select: www1" https://ezrizhu.com | grep ${{ github.sha }}' | |
- name: Ensure that default is updated | |
run: 'curl https://ezrizhu.com | grep ${{ github.sha }}' |