|
| 1 | +name: Dev Deploy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'dev' ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + push_to_registry: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + |
| 11 | + steps: |
| 12 | + - name: Check out the repo |
| 13 | + uses: actions/checkout@v3 |
| 14 | + |
| 15 | + - name: Set up QEMU |
| 16 | + uses: docker/setup-qemu-action@v1 |
| 17 | + with: |
| 18 | + platforms: all |
| 19 | + |
| 20 | + - name: Docker meta |
| 21 | + id: meta |
| 22 | + uses: docker/metadata-action@v3 |
| 23 | + with: |
| 24 | + images: | |
| 25 | + slatedocs/slate |
| 26 | + tags: | |
| 27 | + type=ref,event=branch |
| 28 | +
|
| 29 | + - name: Set up Docker Buildx |
| 30 | + id: buildx |
| 31 | + uses: docker/setup-buildx-action@v1 |
| 32 | + |
| 33 | + - name: Login to DockerHub |
| 34 | + uses: docker/login-action@v1 |
| 35 | + with: |
| 36 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 37 | + password: ${{ secrets.DOCKER_ACCESS_KEY }} |
| 38 | + |
| 39 | + - name: Push to Docker Hub |
| 40 | + uses: docker/build-push-action@v2 |
| 41 | + with: |
| 42 | + builder: ${{ steps.buildx.outputs.name }} |
| 43 | + context: . |
| 44 | + file: ./Dockerfile |
| 45 | + platforms: linux/amd64,linux/arm64,linux/ppc64le |
| 46 | + push: true |
| 47 | + tags: ${{ steps.meta.outputs.tags }} |
| 48 | + labels: ${{ steps.meta.outputs.labels }} |
| 49 | + |
| 50 | + deploy_gh: |
| 51 | + permissions: |
| 52 | + contents: write |
| 53 | + |
| 54 | + runs-on: ubuntu-latest |
| 55 | + env: |
| 56 | + ruby-version: 2.6 |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v3 |
| 60 | + - name: Set up Ruby |
| 61 | + uses: ruby/setup-ruby@v1 |
| 62 | + with: |
| 63 | + ruby-version: ${{ env.ruby-version }} |
| 64 | + |
| 65 | + - uses: actions/cache@v3 |
| 66 | + with: |
| 67 | + path: vendor/bundle |
| 68 | + key: gems-${{ runner.os }}-${{ env.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} |
| 69 | + restore-keys: | |
| 70 | + gems-${{ runner.os }}-${{ env.ruby-version }}- |
| 71 | + gems-${{ runner.os }}- |
| 72 | + - run: bundle config set deployment 'true' |
| 73 | + - name: bundle install |
| 74 | + run: | |
| 75 | + bundle config path vendor/bundle |
| 76 | + bundle install --jobs 4 --retry 3 |
| 77 | + - run: bundle exec middleman build |
| 78 | + |
| 79 | + - name: Deploy |
| 80 | + |
| 81 | + with: |
| 82 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + destination_dir: dev |
| 84 | + publish_dir: ./build |
| 85 | + keep_files: true |
0 commit comments