diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..eceaf4aa3 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,102 @@ +name: release + +on: + push: + tags: + - v*.*.* + branches-ignore: + - '**' + +jobs: + build-images: + name: Build Images + runs-on: ubuntu-latest + strategy: + matrix: + component: + - ns-builder + - ns-controller + - ns-gateway + - ns-migrate + - ns-ssgen + steps: + - uses: actions/checkout@v3 + - name: Set APP_VERSION env + run: echo "APP_VERSION=$(echo ${GITHUB_REF:11})" >> $GITHUB_ENV + - name: Set APP_REVISION env + run: echo "APP_REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Builder instance name + run: echo ${{ steps.buildx.outputs.name }} + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: traptitech + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build + uses: docker/build-push-action@v4 + with: + context: . + target: ${{ matrix.component }} + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + APP_VERSION=${{ env.APP_VERSION }} + APP_REVISION=${{ env.APP_REVISION }} + tags: | + ghcr.io/traptitech/${{ matrix.component }}:latest + ghcr.io/traptitech/${{ matrix.component }}:${{ env.APP_VERSION }} + cache-from: type=registry,ref=ghcr.io/traptitech/${{ matrix.component }}:buildcache + + build-dashboard-image: + name: Build Dashboard Image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set APP_VERSION env + run: echo "APP_VERSION=$(echo ${GITHUB_REF:11})" >> $GITHUB_ENV + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Builder instance name + run: echo ${{ steps.buildx.outputs.name }} + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: traptitech + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build + uses: docker/build-push-action@v4 + with: + context: dashboard + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/traptitech/ns-dashboard:latest + ghcr.io/traptitech/ns-dashboard:${{ env.APP_VERSION }} + cache-from: type=registry,ref=ghcr.io/traptitech/ns-dashboard:buildcache + + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Release + uses: softprops/action-gh-release@v1