From 6dc4b280559b3921302cd6734af61c8d27d48409 Mon Sep 17 00:00:00 2001 From: Uwe Sommerlatt Date: Sun, 3 Jan 2021 20:27:18 +0100 Subject: [PATCH 1/2] Incorporate upx workflow in CI/CD workflow --- .github/workflows/ci_cd.yaml | 12 +++++++----- .github/workflows/upx.yaml | 26 -------------------------- 2 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/upx.yaml diff --git a/.github/workflows/ci_cd.yaml b/.github/workflows/ci_cd.yaml index 55766e3..d7c1a9d 100644 --- a/.github/workflows/ci_cd.yaml +++ b/.github/workflows/ci_cd.yaml @@ -30,11 +30,13 @@ jobs: TOKEN: ${{ secrets.PAT_GHCR }} USERNAME: ${{ github.repository_owner }} run: echo $TOKEN | docker login ghcr.io -u $USERNAME --password-stdin - - name: Create docker image - run: sbt docker - - name: Publish docker image to ghcr.io - run: sbt dockerPush - - name: Tag image for gcr.io + - name: Create and publish a docker image with a UPX compressed executable + run: export UPX_COMPRESSION='--best'; sbt ';docker;dockerPush' + - name: Create and publish docker image without compression + run: sbt ';docker;dockerPush' + - name: Remove image with UPX compressed executable + run: docker rmi $(docker images -q 'ghcr.io/usommerl/graalnative4s*upx*') + - name: Tag remaining image for gcr.io run: | export IMAGE_GHCR=$(docker images ghcr.io/usommerl/graalnative4s --format "{{.Repository}}:{{.Tag}}") export IMAGE_GCR=$(echo $IMAGE_GHCR | sed 's/ghcr.io/eu.gcr.io/') diff --git a/.github/workflows/upx.yaml b/.github/workflows/upx.yaml deleted file mode 100644 index 5f13746..0000000 --- a/.github/workflows/upx.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: upx - -on: - push: - tags: - - "v*" - -jobs: - upx: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - name: Docker login - env: - TOKEN: ${{ secrets.PAT_GHCR }} - USERNAME: ${{ github.repository_owner }} - run: echo $TOKEN | docker login ghcr.io -u $USERNAME --password-stdin - - name: Create docker image with a UPX compressed executable - run: export UPX_COMPRESSION="--best"; sbt docker - - name: Publish docker image to ghcr.io - run: sbt dockerPush From bf64bedc92b407b456da05597cfd6427e38b9d9c Mon Sep 17 00:00:00 2001 From: Uwe Sommerlatt Date: Sun, 3 Jan 2021 20:35:12 +0100 Subject: [PATCH 2/2] Incorporate release workflow in CI/CD workflow --- .github/workflows/ci_cd.yaml | 16 ++++++++++++++++ .github/workflows/release.yml | 29 ----------------------------- 2 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci_cd.yaml b/.github/workflows/ci_cd.yaml index d7c1a9d..4b865a9 100644 --- a/.github/workflows/ci_cd.yaml +++ b/.github/workflows/ci_cd.yaml @@ -51,3 +51,19 @@ jobs: region: europe-west1 env: .github/workflows/cloud_run_env_vars service key: ${{ secrets.GCP_SA_KEY }} + - name: Generate release changelog + id: generate-release-changelog + uses: heinrichreimer/github-changelog-generator-action@v2.1.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + onlyLastTag: "true" + stripHeaders: "true" + stripGeneratorNotice: "true" + - name: Create GitHub release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: ${{ steps.generate-release-changelog.outputs.changelog }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index aa199da..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: release - -on: - push: - tags: - - "v*" - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: Generate release changelog - id: generate-release-changelog - uses: heinrichreimer/github-changelog-generator-action@v2.1.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - onlyLastTag: "true" - stripHeaders: "true" - stripGeneratorNotice: "true" - - name: Create GitHub release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body: ${{ steps.generate-release-changelog.outputs.changelog }}