Skip to content

Commit

Permalink
Build and upload tar package on release
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed Nov 24, 2022
1 parent 54efd70 commit 7a9fdd6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- v*

name: Create Release

Expand All @@ -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<<EOF' >> $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 }}
14 changes: 14 additions & 0 deletions tar.Dockerfile
Original file line number Diff line number Diff line change
@@ -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 .

0 comments on commit 7a9fdd6

Please sign in to comment.