refactor editing posts #42
This file contains hidden or 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: Build and deploy portfolio site to Docker Hub and trigger Watchtower | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| DART_SASS_VERSION: 1.97.3 | |
| GO_VERSION: 1.25.6 | |
| HUGO_VERSION: 0.155.0 | |
| NODE_VERSION: 24.13.0 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install Dart Sass | |
| run: | | |
| curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" | |
| tar -C /usr/local/bin -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" --strip-components=1 dart-sass/sass | |
| rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz" | |
| - name: Install Hugo | |
| run: | | |
| curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| tar -C /usr/local/bin -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" hugo | |
| rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| - name: Install Node.js dependencies | |
| run: | | |
| [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true | |
| - name: Build the site | |
| run: | | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --baseURL "https://corral.dk/" | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/portfolio-site:latest | |
| - name: Trigger Watchtower Webhook | |
| run: | | |
| curl -f -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" https://deploy.corral.dk/v1/update |