name: "Build and publish docker image" on: push: branches: - main paths-ignore: - .gitignore - README.md - LICENSE # Allow one concurrent deployment concurrency: group: "blog" cancel-in-progress: true jobs: build-site: name: Build Jekyll Site runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 # submodules: true # If using the 'assets' git submodule from Chirpy Starter, uncomment above # (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets) # Build and test site - name: Setup Ruby uses: https://github.com/ruby/setup-ruby@v1 with: ruby-version: 3.3 bundler-cache: true - name: Build site run: bundle exec jekyll b -d _site env: JEKYLL_ENV: "production" - name: Test site run: | bundle exec htmlproofer _site \ \-\-disable-external \ \-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/" # Upload artifact - name: Upload artifacts uses: forgejo/upload-artifact@v4 # temporary fork until actions/upload-artifact supports GHES with: name: jekyll-chirpy-blog path: _site retention-days: 1 build-docker: name: Build Docker Image runs-on: ubuntu-latest needs: build-site permissions: packages: write steps: # Needed so that download artifacts knows it's a local repo - name: Checkout code uses: actions/checkout@v4 - name: Download artifacts uses: forgejo/download-artifact@v4 # temporary fork until actions/download-artifact supports GHES - name: Move to correct directory run: | mv jekyll-chirpy-blog _site - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} # - name: Set up QEMU # uses: docker/setup-qemu-action@v3 # - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 # Login to fogejo registry - name: Login to Docker Hub uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_SERVER_URL }} username: ${{ env.GITHUB_REPOSITORY_OWNER }} password: ${{ secrets.FORGEJO_REGISTRY_TOKEN }} # Check how to push to forgejo's repo - name: Build and push uses: docker/build-push-action@v6 with: context: . push: true tags: git.martin.md/radu/blog:latest