From b299127bc4ab768fe14ffb5493b884548bdb4d5d Mon Sep 17 00:00:00 2001 From: Neha Naithani Date: Wed, 31 Jan 2024 14:22:56 +1300 Subject: [PATCH] Test tags --- .github/workflows/ci.yaml | 89 +++++++++++++++++++++++++++++++++------ build.gradle | 2 +- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0bae2979..8ca12c6d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -73,15 +73,22 @@ jobs: if: always() run: sudo bash test/deploy_ecn.bash deleteECN - Publish: + Publish_dev: runs-on: ubuntu-20.04 - needs: [Build] + needs: [Build, Integration] permissions: contents: 'read' id-token: 'write' packages: 'write' - name: Publish + outputs: + version: ${{ steps.step1.outputs.pkg_version }} + name: Publish_dev steps: + - name: Test + if: startsWith(github.ref, 'refs/tags/v') + shell: bash + run: | + echo "I am the tag" - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -128,7 +135,7 @@ jobs: dockerfile: Dockerfile - name: Login to Github Container Registry - if: (github.ref == 'refs/heads/develop') || contains(github.ref_name, '^v.*') + if: ${{ github.ref_name == 'develop' && || startsWith(github.ref, 'refs/tags/v') }} uses: docker/login-action@v2 with: registry: "ghcr.io" @@ -136,7 +143,7 @@ jobs: password: ${{ github.token }} - name: Build and Push to ghcr - if: (github.ref == 'refs/heads/develop') || contains(github.ref_name, '^v.*') + if: ${{ github.ref_name == 'develop' && || startsWith(github.ref, 'refs/tags/v') }} uses: docker/build-push-action@v3 id: build_push_ghcr with: @@ -233,8 +240,71 @@ jobs: PACKAGECLOUD-DISTRIB: rpm_any/rpm_any PACKAGECLOUD-TOKEN: ${{ secrets.packagecloud_token }} + - name: Upload Agent Artifact + uses: actions/upload-artifact@v3 + with: + name: agent + path: packaging/**/* + + Publish_prod: + runs-on: ubuntu-20.04 + needs: [ Build, Integration, Publish_dev ] + if: startsWith(github.ref, 'refs/tags/v') + permissions: + contents: 'read' + id-token: 'write' + packages: 'write' + name: Publish + steps: +# - uses: actions/checkout@v3 +# with: +# fetch-depth: 0 +# - name: 'Get Previous tag' +# id: previoustag +# uses: "WyriHaximus/github-action-get-previous-tag@v1" +# with: +# fallback: 0.0.0 +# +# - name: Set up Ruby 3.1.4 +# uses: actions/setup-ruby@v1 +# with: +# ruby-version: 3.1.4 +# - run: | +# gem install --no-document fpm +# fpm -h +# - name: Install package_Cloud +# run: | +# gem install package_cloud +# package_cloud -h +# - name: get gradle version +# shell: bash +# id: version +# run: echo "version=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')" >> "${GITHUB_OUTPUT}" +# - name: get package version +# shell: bash +# id: pkg_version +# run: | +# if [[ ${{ github.ref_name }} =~ ^v.* ]] ; then +# echo "version=${{ steps.version.outputs.version }}" >> "${GITHUB_OUTPUT}" +# else +# echo "version=${{ steps.version.outputs.version }}-${{ github.run_number }}" >> "${GITHUB_OUTPUT}" +# fi + - run: echo ${{needs.Publish_dev.outputs.version}} + - name : Test + if: startsWith(github.ref, 'refs/tags/v') + shell: bash + run: | + echo "I am in the tag" + - uses: actions/download-artifact@v2 + with: + name: deb-package + + - uses: actions/download-artifact@v2 + with: + name: rpm-package + - name: Publish tagged deb package to packagecloud - if: contains(github.ref_name, '^v.*') + if: startsWith(github.ref, 'refs/tags/v') uses: danielmundi/upload-packagecloud@v1 with: PACKAGE-NAME: iofog-agent_${{ steps.pkg_version.outputs.version }}_all.deb @@ -244,7 +314,7 @@ jobs: PACKAGECLOUD-TOKEN: ${{ secrets.packagecloud_token }} - name: Publish tagged rpm package to packagecloud - if: contains(github.ref_name, '^v.*') + if: startsWith(github.ref, 'refs/tags/v') uses: danielmundi/upload-packagecloud@v1 with: PACKAGE-NAME: packaging/iofog-agent/iofog-agent-${{ steps.sub.outputs.result }}-1.noarch.rpm @@ -253,11 +323,6 @@ jobs: PACKAGECLOUD-DISTRIB: rpm_any/rpm_any PACKAGECLOUD-TOKEN: ${{ secrets.packagecloud_token }} - - name: Upload Agent Artifact - uses: actions/upload-artifact@v3 - with: - name: agent - path: packaging/**/* diff --git a/build.gradle b/build.gradle index 3e5d6d0e..e63548f0 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { allprojects { group = 'org.eclipse' - version = '3.1.0' + version = '3.0.3' } subprojects {