From 25a0c2339e9339b070666755fa51246351d83702 Mon Sep 17 00:00:00 2001 From: Lubos Kozmon Date: Thu, 25 Jul 2024 23:30:25 +0100 Subject: [PATCH] Update workflow --- .github/workflows/{ci.yml => publish.yml} | 60 +++++++++++++---------- build/snap/snapcraft.yaml | 14 +++--- 2 files changed, 39 insertions(+), 35 deletions(-) rename .github/workflows/{ci.yml => publish.yml} (77%) diff --git a/.github/workflows/ci.yml b/.github/workflows/publish.yml similarity index 77% rename from .github/workflows/ci.yml rename to .github/workflows/publish.yml index 132e148..7ba06ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: CI +name: Publish on: push: @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive @@ -25,7 +25,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive @@ -49,14 +49,10 @@ jobs: build_date: ${{ steps.set_vars.outputs.build_date }} steps: - - name: Get version - id: get_version - uses: battila7/get-version-action@v2 - - id: set_vars name: Set variables run: | - tag="${{ steps.get_version.outputs.version-without-v }}" + tag="${GITHUB_REF_NAME#v}" # is this a semver release? if [[ "${tag}" =~ ^[0-9]+(\.[0-9]+){2,3}$ ]]; @@ -91,23 +87,29 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERIO_USERNAME }} + password: ${{ secrets.DOCKERIO_PASSWORD }} - - name: Build Docker image - uses: docker/build-push-action@v4 + - name: Build and push Docker image + uses: docker/build-push-action@v6 with: context: . file: ${{ github.workspace }}/build/docker/Dockerfile platforms: linux/amd64,linux/arm64 - push: false + push: true outputs: type=local,dest=out tags: ${{ needs.setup_env.outputs.docker_image }}:${{ needs.setup_env.outputs.docker_tag }} build-args: APP_VERSION=${{ needs.setup_env.outputs.app_version }},DOCS_URL=${{ needs.setup_env.outputs.docs_url }},VCS_REF=${{ needs.setup_env.outputs.vcs_ref }},BUILD_DATE=${{ needs.setup_env.outputs.build_date }} @@ -122,7 +124,7 @@ jobs: path: jars.tar.gz build_snap: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: - setup_env @@ -130,31 +132,35 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download jars uses: actions/download-artifact@v1 with: name: jars - - name: Install Snapcraft - uses: samuelmeuli/action-snapcraft@v1 - with: - use_lxd: true - - - name: Snap Build + - name: Prepare source run: | - echo "$APP_VERSION" \ + echo "${{ needs.setup_env.outputs.app_version }}" \ > ${GITHUB_WORKSPACE}/build/snap/local/version tar \ -xvf ${GITHUB_WORKSPACE}/jars/jars.tar.gz \ -C ${GITHUB_WORKSPACE}/build/snap/local - cd ${GITHUB_WORKSPACE}/build - sg lxd -c 'snapcraft snap --use-lxd -o zoonavigator_amd64.snap' + - id: build_snap + name: Build Snap + uses: snapcore/action-build@v1 + with: + path: build/ - snapcraft upload --release=${{ needs.setup_env.outputs.snap_channel }} build/zoonavigator_amd64.snap + - name: Publish Snap + uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_CREDENTIALS }} + with: + snap: ${{ steps.build_snap.outputs.snap }} + release: ${{ needs.setup_env.outputs.snap_channel }} cleanup: runs-on: ubuntu-latest @@ -167,6 +173,6 @@ jobs: steps: - name: Delete artifacts - uses: geekyeggo/delete-artifact@v1 + uses: geekyeggo/delete-artifact@v5 with: name: jars \ No newline at end of file diff --git a/build/snap/snapcraft.yaml b/build/snap/snapcraft.yaml index 30c7dcd..ccaeb27 100644 --- a/build/snap/snapcraft.yaml +++ b/build/snap/snapcraft.yaml @@ -9,17 +9,17 @@ description: | Built from the upstream source at https://github.com/elkozmon/zoonavigator. -base: core18 +base: core22 grade: stable confinement: strict adopt-info: zoonavigator apps: zoonavigator: - command: zoonavigator + command: bin/zoonavigator daemon: simple environment: - JAVA_HOME: $SNAP/usr/lib/jvm/java-11-openjdk-$SNAP_ARCH + JAVA_HOME: $SNAP/usr/lib/jvm/java-17-openjdk-$SNAP_ARCH PATH: $JAVA_HOME/bin:$PATH plugs: - network @@ -33,14 +33,12 @@ parts: bin/configure: snap/hooks/configure parse-info: [] override-pull: | - snapcraftctl pull - snapcraftctl set-version $(cat version) + craftctl default + craftctl set version=$(cat version) build-packages: - ca-certificates - ca-certificates-java - stage: - - -usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs stage-packages: - - openjdk-11-jdk-headless + - openjdk-17-jdk-headless - krb5-user - jq