From f1ac55d322e07122b61d4d1743f833d7bf460cbc Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 8 Jan 2024 15:57:38 -0800 Subject: [PATCH] build-system: replace repetitive GH Action code with script call This is now much easier to maintain. Signed-off-by: Dirk Hohndel --- .github/workflows/android.yml | 14 +------------- .github/workflows/fedora-copr-build.yml | 14 +------------- .github/workflows/linux-snap.yml | 14 +------------- .github/workflows/linux-trusty-5.12.yml | 14 +------------- .github/workflows/mac.yml | 14 +------------- .github/workflows/ubuntu-launchpad-build.yml | 14 +------------- .github/workflows/windows.yml | 14 +------------- 7 files changed, 7 insertions(+), 91 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 8bc47d48b..deb290761 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -25,19 +25,7 @@ jobs: id: version_number if: github.event_name == 'push' run: | - cd $BUILD_ROOT # check out parallel to subsurface sources - url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds" - # the clone followed by the pointless push should verify that the password is stored in the config - # that way the script doesn't need the password - git clone -b main https://github.com/subsurface/nightly-builds - cd nightly-builds - git remote set-url origin "$url" - git push origin main - cd .. - bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }} - cp nightly-builds/latest-subsurface-buildnumber subsurface - echo "CICD-release" > subsurface/latest-subsurface-buildnumber-extension - version=$(bash subsurface/scripts/get-version) + version=$(bash subsurface/scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release") echo "version=$version" >> $GITHUB_OUTPUT - name: store dummy version and build number for non-push build runs diff --git a/.github/workflows/fedora-copr-build.yml b/.github/workflows/fedora-copr-build.yml index a13c89b64..8d402e987 100644 --- a/.github/workflows/fedora-copr-build.yml +++ b/.github/workflows/fedora-copr-build.yml @@ -29,19 +29,7 @@ jobs: id: version_number if: github.event_name == 'push' run: | - cd .. # check out parallel to subsurface sources - url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds" - # the clone followed by the pointless push should verify that the password is stored in the config - # that way the script doesn't need the password - git clone -b main https://github.com/subsurface/nightly-builds - cd nightly-builds - git remote set-url origin "$url" - git push origin main - cd .. - bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }} - cp nightly-builds/latest-subsurface-buildnumber subsurface - echo "CICD-release" > subsurface/latest-subsurface-buildnumber-extension - version=$(bash subsurface/scripts/get-version) + version=$(bash subsurface/scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release") echo "version=$version" >> $GITHUB_OUTPUT - name: Setup API token for copr-cli diff --git a/.github/workflows/linux-snap.yml b/.github/workflows/linux-snap.yml index badd89d44..98572f403 100644 --- a/.github/workflows/linux-snap.yml +++ b/.github/workflows/linux-snap.yml @@ -24,19 +24,7 @@ jobs: id: version_number if: github.event_name == 'push' run: | - cd .. # check out parallel to subsurface sources - url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds" - # the clone followed by the pointless push should verify that the password is stored in the config - # that way the script doesn't need the password - git clone -b main https://github.com/subsurface/nightly-builds - cd nightly-builds - git remote set-url origin "$url" - git push origin main - cd .. - bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }} - cp nightly-builds/latest-subsurface-buildnumber subsurface - echo "CICD-release" > subsurface/latest-subsurface-buildnumber-extension - version=$(bash subsurface/scripts/get-version) + version=$(bash subsurface/scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release") echo "version=$version" >> $GITHUB_OUTPUT - name: store dummy version and build number for pull request diff --git a/.github/workflows/linux-trusty-5.12.yml b/.github/workflows/linux-trusty-5.12.yml index 0784652c5..b866a7336 100644 --- a/.github/workflows/linux-trusty-5.12.yml +++ b/.github/workflows/linux-trusty-5.12.yml @@ -21,19 +21,7 @@ jobs: id: version_number if: github.event_name == 'push' run: | - cd .. # check out parallel to subsurface sources - url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds" - # the clone followed by the pointless push should verify that the password is stored in the config - # that way the script doesn't need the password - git clone -b main https://github.com/subsurface/nightly-builds - cd nightly-builds - git remote set-url origin "$url" - git push origin main - cd .. - bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }} - cp nightly-builds/latest-subsurface-buildnumber subsurface - echo "CICD-release" > subsurface/latest-subsurface-buildnumber-extension - version=$(bash subsurface/scripts/get-version) + version=$(bash subsurface/scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release") echo "version=$version" >> $GITHUB_OUTPUT - name: store dummy version and build number for pull request diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 1c041fedb..75c106f35 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -18,19 +18,7 @@ jobs: id: version_number if: github.event_name == 'push' run: | - cd .. # check out parallel to subsurface sources - url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds" - # the clone followed by the pointless push should verify that the password is stored in the config - # that way the script doesn't need the password - git clone -b main https://github.com/subsurface/nightly-builds - cd nightly-builds - git remote set-url origin "$url" - git push origin main - cd .. - bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }} - cp nightly-builds/latest-subsurface-buildnumber subsurface - echo "CICD-release" > subsurface/latest-subsurface-buildnumber-extension - version=$(bash subsurface/scripts/get-version) + version=$(bash subsurface/scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release") echo "version=$version" >> $GITHUB_OUTPUT - name: store dummy version and build number for pull request diff --git a/.github/workflows/ubuntu-launchpad-build.yml b/.github/workflows/ubuntu-launchpad-build.yml index 533ab21f5..a2da0716d 100644 --- a/.github/workflows/ubuntu-launchpad-build.yml +++ b/.github/workflows/ubuntu-launchpad-build.yml @@ -18,19 +18,7 @@ jobs: id: version_number if: github.event_name == 'push' run: | - cd .. # check out parallel to subsurface sources - url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds" - # the clone followed by the pointless push should verify that the password is stored in the config - # that way the script doesn't need the password - git clone -b main https://github.com/subsurface/nightly-builds - cd nightly-builds - git remote set-url origin "$url" - git push origin main - cd .. - bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }} - cp nightly-builds/latest-subsurface-buildnumber subsurface - echo "CICD-release" > subsurface/latest-subsurface-buildnumber-extension - version=$(bash subsurface/scripts/get-version) + version=$(bash subsurface/scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release") echo "version=$version" >> $GITHUB_OUTPUT - name: Setup build dependencies diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d3c64bf53..62df63345 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -21,19 +21,7 @@ jobs: id: version_number if: github.event_name == 'push' run: | - cd .. # check out parallel to subsurface sources - url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds" - # the clone followed by the pointless push should verify that the password is stored in the config - # that way the script doesn't need the password - git clone -b main https://github.com/subsurface/nightly-builds - cd nightly-builds - git remote set-url origin "$url" - git push origin main - cd .. - bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }} - cp nightly-builds/latest-subsurface-buildnumber subsurface - echo "CICD-release" > subsurface/latest-subsurface-buildnumber-extension - version=$(bash subsurface/scripts/get-version) + version=$(bash subsurface/scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release") echo "version=$version" >> $GITHUB_OUTPUT - name: store dummy version and build number for pull request