|
| 1 | +name: release |
| 2 | +on: |
| 3 | + push: |
| 4 | + # Sequence of patterns matched against refs/tags |
| 5 | + tags: |
| 6 | + - '*' # Push events to matching v*, i.e. v1.0, v0.4.4 |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v2 |
| 14 | + - name: Set up CI Image Metadata |
| 15 | + id: docker_meta_ci |
| 16 | + uses: crazy-max/ghaction-docker-meta@v1 |
| 17 | + with: |
| 18 | + images: solidnerd/bookstack-dev |
| 19 | + tag-sha: true |
| 20 | + - name: Set up Docker Buildx |
| 21 | + uses: docker/setup-buildx-action@v1 |
| 22 | + - name: Build and push Dev |
| 23 | + uses: docker/build-push-action@v2 |
| 24 | + with: |
| 25 | + context: . |
| 26 | + file: ./Dockerfile |
| 27 | + platforms: linux/amd64 |
| 28 | + push: false |
| 29 | + tags: | |
| 30 | + ${{ steps.docker_meta_ci.outputs.tags }} |
| 31 | + labels: ${{ steps.docker_meta_ci.outputs.labels }} |
| 32 | + cache-from: type=registry,ref=solidnerd/bookstack-dev:master |
| 33 | + outputs: type=docker,dest=/tmp/image-bookstack.tar |
| 34 | + - name: Upload artifact |
| 35 | + uses: actions/upload-artifact@v2 |
| 36 | + with: |
| 37 | + name: image-bookstack-master |
| 38 | + path: /tmp/image-bookstack.tar |
| 39 | + e2e: |
| 40 | + runs-on: ubuntu-latest |
| 41 | + needs: build |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v2 |
| 45 | + - name: Download artifact |
| 46 | + uses: actions/download-artifact@v2 |
| 47 | + with: |
| 48 | + name: image-bookstack-master |
| 49 | + path: /tmp |
| 50 | + - name: Load Docker image |
| 51 | + run: | |
| 52 | + docker load --input /tmp/image-bookstack.tar |
| 53 | + docker image ls -a |
| 54 | + push: |
| 55 | + runs-on: ubuntu-20.04 |
| 56 | + needs: e2e |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v2 |
| 60 | + - name: Set up Docker Hub Image Metadata |
| 61 | + id: docker_meta |
| 62 | + uses: crazy-max/ghaction-docker-meta@v1 |
| 63 | + with: |
| 64 | + images: solidnerd/bookstack,ghcr.io/solidnerd/docker-bookstack |
| 65 | + tag-semver: | |
| 66 | + {{version}} |
| 67 | + {{major}}.{{minor}} |
| 68 | + {{major}}.{{minor}}.{{patch}} |
| 69 | + - name: Download artifact |
| 70 | + uses: actions/download-artifact@v2 |
| 71 | + with: |
| 72 | + name: image-bookstack-master |
| 73 | + path: /tmp |
| 74 | + - name: Load Docker image |
| 75 | + run: | |
| 76 | + docker load --input /tmp/image-bookstack.tar |
| 77 | + docker image ls -a |
| 78 | + - name: Set up QEMU |
| 79 | + uses: docker/setup-qemu-action@v1 |
| 80 | + - name: Set up Docker Buildx |
| 81 | + uses: docker/setup-buildx-action@v1 |
| 82 | + - name: Login to DockerHub |
| 83 | + if: github.event_name != 'pull_request' |
| 84 | + uses: docker/login-action@v1 |
| 85 | + with: |
| 86 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 87 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 88 | + - name: Login to GitHub Container Registry |
| 89 | + uses: docker/login-action@v1 |
| 90 | + with: |
| 91 | + registry: ghcr.io |
| 92 | + username: ${{ github.repository_owner }} |
| 93 | + password: ${{ secrets.CR_PAT }} |
| 94 | + - name: Build and Push master |
| 95 | + uses: docker/build-push-action@v2 |
| 96 | + with: |
| 97 | + context: . |
| 98 | + file: ./Dockerfile |
| 99 | + platforms: linux/amd64 |
| 100 | + push: ${{ github.event_name != 'pull_request' }} |
| 101 | + tags: | |
| 102 | + ${{ steps.docker_meta.outputs.tags }} |
| 103 | + labels: ${{ steps.docker_meta.outputs.labels }} |
| 104 | + cache-from: type=registry,ref=solidnerd/bookstack-dev:${{ github.sha }} |
| 105 | + cache-to: type=registry,ref=solidnerd/bookstack-dev:${{ github.sha }} |
| 106 | + create-release: |
| 107 | + runs-on: ubuntu-20.04 |
| 108 | + needs: push |
| 109 | + steps: |
| 110 | + # To use this repository's private action, you must check out the repository |
| 111 | + - name: Checkout |
| 112 | + uses: actions/checkout@v2 |
| 113 | + - name: Generate changelog |
| 114 | + id: changelog |
| 115 | + uses: metcalfc/changelog-generator@v0.4.4 |
| 116 | + with: |
| 117 | + myToken: ${{ secrets.GITHUB_TOKEN }} |
| 118 | + - name: Create Release |
| 119 | + id: create_release |
| 120 | + uses: actions/create-release@v1.1.4 |
| 121 | + env: |
| 122 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 123 | + with: |
| 124 | + tag_name: ${{ github.ref }} |
| 125 | + release_name: ${{ github.ref }} |
| 126 | + body: ${{ steps.changelog.outputs.changelog }} |
| 127 | + draft: false |
| 128 | + prerelease: false |
0 commit comments