From f44be0dc5d7cba8ee5fab5b9f7e3b21b8dd2dd6d Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Sun, 24 Dec 2023 11:14:06 -0300 Subject: [PATCH] ci: fix dockerfile entrypoint --- .github/Dockerfile | 7 +++- .github/workflows/release.yml | 69 +++++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 17 deletions(-) diff --git a/.github/Dockerfile b/.github/Dockerfile index e16d0c9..4505cea 100644 --- a/.github/Dockerfile +++ b/.github/Dockerfile @@ -1,7 +1,10 @@ -FROM alpine:latest +FROM debian:12-slim + +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* ARG TARGETARCH -COPY dmtrd-${TARGETARCH} /bin/dmtrd +COPY binaries/Linux-GNU-${TARGETARCH}-dmtrd /bin/dmtrd +RUN chmod +x /bin/dmtrd RUN ln -s /bin/dmtrd /dmtrd ENTRYPOINT ["dmtrd"] \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8789548..7d159dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ name: Release - on: push: - tags: v* + tags: + - "v*" jobs: build: @@ -11,46 +11,53 @@ jobs: strategy: matrix: include: - - release_for: Linux-GNU-x86_64 + - release_for: Linux-GNU-amd64 os: ubuntu-latest target: x86_64-unknown-linux-gnu - arch: amd64 args: "--locked --release" + bin: dmtrd - - release_for: Linux-GNU-armv7 + - release_for: Linux-GNU-arm64 os: ubuntu-latest target: "aarch64-unknown-linux-gnu" - arch: arm64 args: "--locked --release" + bin: dmtrd runs-on: ${{ matrix.os }} steps: - - name: Checkout repository - uses: actions/checkout@v2 - - uses: Swatinem/rust-cache@v2 - - - name: Checkout + - name: checkout repository uses: actions/checkout@v3 - - name: Build binary + - uses: Swatinem/rust-cache@v2 + + - name: build binary uses: houseabsolute/actions-rust-cross@v0 with: - command: both + command: build target: ${{ matrix.target }} args: ${{ matrix.args }} strip: true + - name: rename binaries + run: | + mv target/${{ matrix.target }}/release/${{ matrix.bin }} ${{ matrix.release_for }}-${{ matrix.bin }} + - name: upload artifacts uses: actions/upload-artifact@v3 with: - name: dmtrd-${{ matrix.arch }} - path: target/${{ matrix.target }}/release/dmtrd + name: binaries + path: ${{ matrix.release_for }}-${{ matrix.bin }} docker: runs-on: ubuntu-latest needs: [build] + + permissions: + contents: read + packages: write + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -88,3 +95,35 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + release: + needs: [build, docker] + + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: setup go + uses: actions/setup-go@v4 + with: + go-version: "1.16" + + - name: download artifacts + id: "download" + uses: actions/download-artifact@v3 + + - name: set release notes + run: | + go install github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.0 + git-chglog -c .github/chglog/release.yml $(git describe --tags) > RELEASE.md + + - name: create release + uses: softprops/action-gh-release@v1 + with: + files: binaries/* + body_path: RELEASE.md + draft: true