diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79ed6c8..8f27a0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ on: push: tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + - v* name: Create Release @@ -10,27 +10,23 @@ jobs: name: Create Release runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 # to be able to figure out which is next to latest tag + - name: Checkout the repository + run: git clone ${{ github.repositoryUrl }} . + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - # Needed because of https://github.com/actions/checkout/issues/290 - - name: Fetch annotated tags - run: git fetch --force --tags + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: Construct the release notes - run: | - echo 'RELEASE_NOTES<> $GITHUB_ENV - ./build/release_notes >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV + - name: Build static tar package + uses: docker/build-push-action@v3 + with: + file: tar.Dockerfile + platforms: linux/amd64,linux/arm64 + outputs: . - name: Create Release - id: create_release - uses: actions/create-release@v1 + run: gh release create "${{ github.ref }}" ./*.tar.gz --notes "$(./build/release_notes)" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body: ${{ env.RELEASE_NOTES }} diff --git a/tar.Dockerfile b/tar.Dockerfile new file mode 100644 index 0000000..e3f8f20 --- /dev/null +++ b/tar.Dockerfile @@ -0,0 +1,14 @@ +FROM 84codes/crystal:latest-alpine AS builder +WORKDIR /usr/src/amqproxy +COPY shard.yml shard.lock ./ +RUN shards install --production +COPY src/ src/ +RUN shards build --production --release --static --debug +COPY README.md LICENSE extras/amqproxy.service amqproxy/ +COPY config/example.ini amqproxy/amqproxy.ini +RUN mv bin/* amqproxy/ +ARG TARGETARCH +RUN tar zcvf amqproxy-$(shards version)_static-$TARGETARCH.tar.gz amqproxy/ + +FROM scratch +COPY --from=builder /usr/src/amqproxy/*.tar.gz .