From e55053644599b766f0c99e43fca4e46de176e867 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 27 Jun 2024 23:09:45 +0200 Subject: [PATCH 01/12] Fix Gitlab CI --- .github/workflows/build.yml | 107 +++++++++++++++--------------------- 1 file changed, 45 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a276c33..da16cbb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,79 +1,62 @@ -name: build +name: Build and Release on: push: tags: - 'v*' -permissions: - id-token: write - contents: write - jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - name: checkout_repo + - name: Checkout repository uses: actions/checkout@v3 - - name: install_buildx - uses: docker/setup-buildx-action@v2 - - name: build_release + + - name: Set up .NET SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '8.0.x' + + - name: Build and package application run: | - TARGET_VERSION="$(echo ${{ github.ref_name }} | cut -c 2-)" - export ACTIONS_CACHE_URL=$(echo "$ACTIONS_ID_TOKEN_REQUEST_URL" | grep -Po 'https://[^/]+/[^/]+/' | sed 's/pipelines/artifactcache/') - export ACTIONS_RUNTIME_TOKEN=$ACTIONS_ID_TOKEN_REQUEST_TOKEN + ./build.sh ${{ github.ref_name }} /tmp/out - docker buildx build --build-arg TARGET_VERSION="$TARGET_VERSION" --cache-to "type=gha,mode=max,scope=build" --cache-from "type=gha,scope=build" . \ - --target=output --output type=local,dest=/tmp/out/ - cp /tmp/out/VmChamp /tmp/out/VmChamp-linux-${{ github.ref_name }}-amd64 - - name: upload_binary - uses: actions/upload-artifact@v3.1.2 + - name: Upload Release Artifact + uses: actions/upload-artifact@v2 with: - name: "VmChamp-linux-${{ github.ref_name }}-amd64" + name: VmChamp-linux-${{ github.ref_name }}-amd64 path: /tmp/out/VmChamp - retention-days: 1 - - name: Release - uses: softprops/action-gh-release@v1 - with: - body: | - ${{ github.event.head_commit.message }} - files: /tmp/out/VmChamp-linux-${{ github.ref_name }}-amd64 - aur: + + release: needs: build - runs-on: ubuntu-22.04 - container: archlinux:base-devel + runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 + - name: Download Release Artifact + uses: actions/download-artifact@v2 with: - name: "VmChamp-linux-${{ github.ref_name }}-amd64" - - name: makepkg - run: | - pacman -Sy - pacman --noconfirm -S git sudo openssh - cd /tmp/ - - eval $(ssh-agent -s) - ssh-add - <<<$(echo "${{ secrets.AUR_KEY }}") - export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" - git clone ssh://aur@aur.archlinux.org/vmchamp-bin.git - git config --global user.email "" - git config --global user.name "${{ github.repository_owner }}" - - cd vmchamp-bin - - REL=1 - - if grep "${{ github.ref_name }}" PKGBUILD; then - REL=$(( $(grep pkgrel PKGBUILD | cut -d = -f 2) + 1 )) - fi - - sed -i s/pkgrel=.*/pkgrel=$REL/g PKGBUILD - sed -i s/pkgver=.*/pkgver=${{ github.ref_name }}/g PKGBUILD - - useradd build - chown -R build:build /tmp/vmchamp-bin - sudo -u build makepkg --force --printsrcinfo > .SRCINFO - chown -R root:root /tmp/vmchamp-bin - git commit -a -m "update ${{ github.ref_name }}" - git log -1 -p - git push origin master + name: VmChamp-linux-${{ github.ref_name }}-amd64 + path: /tmp/release + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + body: | + Release ${{ github.ref_name }} of VmChamp + draft: false + prerelease: false + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: /tmp/release/VmChamp + asset_name: VmChamp-linux-${{ github.ref_name }}-amd64 + asset_content_type: application/octet-stream From 155ef3676cdc78b11e854dd50bdd13bf29b96122 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 27 Jun 2024 23:14:35 +0200 Subject: [PATCH 02/12] Using all tags --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da16cbb..d256a12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build and Release on: push: tags: - - 'v*' + - '*' jobs: build: From 94d325507b8497dc6baa3c1616b84a82e5f8f026 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 27 Jun 2024 23:20:19 +0200 Subject: [PATCH 03/12] Updating ci --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d256a12..6701219 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build and Release on: push: tags: - - '*' + - 'v*' jobs: build: @@ -19,7 +19,9 @@ jobs: - name: Build and package application run: | - ./build.sh ${{ github.ref_name }} /tmp/out + TAG_NAME="${{ github.ref_name }}" + TARGET_VERSION="${TAG_NAME#v}" + ./build.sh "$TARGET_VERSION" /tmp/out - name: Upload Release Artifact uses: actions/upload-artifact@v2 From 3974f942065df812c440cd5eafd0ac4ee5e5085a Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:11:46 +0200 Subject: [PATCH 04/12] Simplify and update CI --- .github/workflows/build.yml | 46 ++++++------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6701219..933d309 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,12 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up .NET SDK - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '8.0.x' + uses: actions/checkout@v4 - name: Build and package application run: | @@ -24,41 +19,14 @@ jobs: ./build.sh "$TARGET_VERSION" /tmp/out - name: Upload Release Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: VmChamp-linux-${{ github.ref_name }}-amd64 path: /tmp/out/VmChamp - - release: - needs: build - runs-on: ubuntu-latest - steps: - - name: Download Release Artifact - uses: actions/download-artifact@v2 + retention-days: 1 + - name: Release + uses: softprops/action-gh-release@v2 with: - name: VmChamp-linux-${{ github.ref_name }}-amd64 - path: /tmp/release - - - name: Create GitHub Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref_name }} - release_name: Release ${{ github.ref_name }} body: | - Release ${{ github.ref_name }} of VmChamp - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: /tmp/release/VmChamp - asset_name: VmChamp-linux-${{ github.ref_name }}-amd64 - asset_content_type: application/octet-stream + ${{ github.event.head_commit.message }} + files: /tmp/out/VmChamp-linux-${{ github.ref_name }}-amd64 From eb6a0602909da7a08e196647b25812d31830682c Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:22:29 +0200 Subject: [PATCH 05/12] UPdating CI --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 933d309..9fa10b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,10 @@ on: tags: - 'v*' +permissions: + id-token: write + contents: write + jobs: build: runs-on: ubuntu-latest @@ -27,6 +31,6 @@ jobs: - name: Release uses: softprops/action-gh-release@v2 with: + files: /tmp/out/VmChamp-linux-${{ github.ref_name }}-amd64 body: | ${{ github.event.head_commit.message }} - files: /tmp/out/VmChamp-linux-${{ github.ref_name }}-amd64 From bb1a1fe8eca0ea758b72721f366289e366e499ed Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:28:07 +0200 Subject: [PATCH 06/12] Updating CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fa10b3..580d2bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,6 @@ jobs: - name: Release uses: softprops/action-gh-release@v2 with: - files: /tmp/out/VmChamp-linux-${{ github.ref_name }}-amd64 + files: VmChamp-linux-${{ github.ref_name }}-amd64 body: | ${{ github.event.head_commit.message }} From f7a4b245a55e23bfaf86ea9f85d3eb6a64d71572 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:35:47 +0200 Subject: [PATCH 07/12] Updating CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 580d2bd..4e095e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,6 @@ jobs: - name: Release uses: softprops/action-gh-release@v2 with: - files: VmChamp-linux-${{ github.ref_name }}-amd64 + files: /tmp/out/VmChamp body: | ${{ github.event.head_commit.message }} From 2f9f72630fa85cf5c5cccd843299f9cc00c689e0 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:42:19 +0200 Subject: [PATCH 08/12] Making two stages --- .github/workflows/build.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e095e0..9d207c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,9 +28,13 @@ jobs: name: VmChamp-linux-${{ github.ref_name }}-amd64 path: /tmp/out/VmChamp retention-days: 1 + + release: + needs: build + steps: - name: Release - uses: softprops/action-gh-release@v2 - with: - files: /tmp/out/VmChamp - body: | - ${{ github.event.head_commit.message }} + uses: softprops/action-gh-release@v2 + with: + files: /tmp/out/VmChamp + body: | + ${{ github.event.head_commit.message }} From eee30049b4003d890d207b306331f2c1cf823636 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:43:30 +0200 Subject: [PATCH 09/12] Fix YAMl issue --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d207c8..c5faf4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,8 @@ jobs: needs: build steps: - name: Release - uses: softprops/action-gh-release@v2 - with: - files: /tmp/out/VmChamp - body: | - ${{ github.event.head_commit.message }} + uses: softprops/action-gh-release@v2 + with: + files: /tmp/out/VmChamp + body: | + ${{ github.event.head_commit.message }} From 26c6f07889ea447417cc51a7e59ad0f0d56200fa Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:43:59 +0200 Subject: [PATCH 10/12] FIxing even harder --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c5faf4c..805d207 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,8 @@ jobs: needs: build steps: - name: Release - uses: softprops/action-gh-release@v2 - with: - files: /tmp/out/VmChamp - body: | - ${{ github.event.head_commit.message }} + uses: softprops/action-gh-release@v2 + with: + files: /tmp/out/VmChamp + body: | + ${{ github.event.head_commit.message }} From 94e42e9da2b221abc45715496b88840e68c3e71b Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:46:10 +0200 Subject: [PATCH 11/12] Runs on fix --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 805d207..cbdd8a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: release: needs: build + runs-on: ubuntu-22.04 steps: - name: Release uses: softprops/action-gh-release@v2 From 4cd396e2cad16136366f7cbe3cc882af5b70b67c Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 28 Jun 2024 08:48:34 +0200 Subject: [PATCH 12/12] Roling back stages --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbdd8a0..0bcbcbc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,10 +29,6 @@ jobs: path: /tmp/out/VmChamp retention-days: 1 - release: - needs: build - runs-on: ubuntu-22.04 - steps: - name: Release uses: softprops/action-gh-release@v2 with: