From 4806a285b6e6719f5ea968a4199a34ee86eb7cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xenxo=20Espasand=C3=ADn?= Date: Mon, 1 Jan 2024 21:15:19 +0100 Subject: [PATCH] feat(build): artifacts & docker image (#169) --- .github/workflows/{build.yml => main.yml} | 38 ++++++++++++++++++----- Dockerfile | 6 ++-- 2 files changed, 32 insertions(+), 12 deletions(-) rename .github/workflows/{build.yml => main.yml} (85%) diff --git a/.github/workflows/build.yml b/.github/workflows/main.yml similarity index 85% rename from .github/workflows/build.yml rename to .github/workflows/main.yml index 33f57aa8..57e8db80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build +name: Main on: push: @@ -166,13 +166,19 @@ jobs: needs: [ build-windows, build-macos, build-linux ] if: startsWith(github.ref, 'refs/tags/') && (github.event.base_ref == 'refs/heads/prod' || github.event.base_ref == 'refs/heads/dev') steps: - - name: Check out files - uses: actions/checkout@v4 - - name: Download Binaries - uses: actions/download-artifact@v3.0.2 - with: - name: windows-x64-release + uses: actions/download-artifact@v3 + + - name: Compress Binaries + run: | + for dir in */; do + if [[ $dir == *"windows"* ]]; then + zip -r "${dir%/}.zip" "$dir" + else + tar -czvf "${dir%/}.tar.gz" "$dir" + fi + done + shell: bash - name: Create Release uses: "marvinpinto/action-automatic-releases@latest" @@ -181,4 +187,20 @@ jobs: prerelease: false draft: true files: | - gsc-tool.exe + *.zip + *.tar.gz + + - name: Checkout Dockerfile + uses: actions/checkout@v4 + with: + sparse-checkout: | + Dockerfile + sparse-checkout-cone-mode: false + + - name: Build and Publish Docker Image + uses: VaultVulp/gp-docker-action@1.6.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + image-name: gsc-tool + extract-git-tag: true + additional-image-tags: latest diff --git a/Dockerfile b/Dockerfile index 5390649b..73ad1c8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,7 @@ FROM alpine:3.19 -# glibc compatibility RUN apk add --no-cache gcompat libstdc++ -# copy gsc-tool -COPY --chmod=755 gsc-tool /usr/local/bin/ +COPY --chmod=755 ./linux-x64-release/gsc-tool /usr/local/bin/ -ENTRYPOINT ["/usr/local/bin/gsc-tool"] \ No newline at end of file +ENTRYPOINT ["/usr/local/bin/gsc-tool"]