From ffaa8aa19736375a41c680e6fc725b5cb59df03e Mon Sep 17 00:00:00 2001 From: Robert Brignull Date: Tue, 13 Oct 2020 10:46:25 +0100 Subject: [PATCH 1/4] add workflow to build runner --- .github/workflows/build-runner.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/build-runner.yml diff --git a/.github/workflows/build-runner.yml b/.github/workflows/build-runner.yml new file mode 100644 index 000000000..1a48c3acd --- /dev/null +++ b/.github/workflows/build-runner.yml @@ -0,0 +1,34 @@ +name: Build runner + +on: + push: + workflow_dispatch: + inputs: + +jobs: + build-runner: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Build runner + run: | + cd runner + npm install + npm run build-runner + + - uses: actions/upload-artifact@v2 + with: + name: codeql-runner-linux + path: runner/dist/codeql-runner-linux + + - uses: actions/upload-artifact@v2 + with: + name: codeql-runner-macos + path: runner/dist/codeql-runner-macos + + - uses: actions/upload-artifact@v2 + with: + name: codeql-runner-win.exe + path: runner/dist/codeql-runner-win.exe From d91d2d2873ec7c4f621a404e23c3e53a338368ff Mon Sep 17 00:00:00 2001 From: Robin Neatherway Date: Tue, 20 Oct 2020 10:55:42 +0100 Subject: [PATCH 2/4] Upload the runner to the release directly --- .github/workflows/build-runner.yml | 52 +++++++++++++++++++----------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-runner.yml b/.github/workflows/build-runner.yml index 1a48c3acd..216fe179b 100644 --- a/.github/workflows/build-runner.yml +++ b/.github/workflows/build-runner.yml @@ -4,31 +4,45 @@ on: push: workflow_dispatch: inputs: + bundle-tag: + description: 'Tag of the bundle release (e.g., "codeql-bundle-20200826")' + required: true jobs: build-runner: runs-on: ubuntu-latest + env: + RELEASE_TAG: test-build-runner # "${{ github.event.inputs.bundle-tag }}" - steps: - - uses: actions/checkout@v2 + strategy: + matrix: + extension: ["linux", "macos", "win.exe"] - - name: Build runner - run: | - cd runner - npm install - npm run build-runner + steps: + - uses: actions/checkout@v2 - - uses: actions/upload-artifact@v2 - with: - name: codeql-runner-linux - path: runner/dist/codeql-runner-linux + - name: Resolve Upload URL for the release + id: save_url + run: | + UPLOAD_URL=$(curl -sS \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_TAG}" \ + -H "Accept: application/json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq .upload_url | sed s/\"//g) + echo ${UPLOAD_URL} + echo "::set-output name=upload_url::${UPLOAD_URL}" - - uses: actions/upload-artifact@v2 - with: - name: codeql-runner-macos - path: runner/dist/codeql-runner-macos + - name: Build runner + run: | + cd runner + npm install + npm run build-runner - - uses: actions/upload-artifact@v2 - with: - name: codeql-runner-win.exe - path: runner/dist/codeql-runner-win.exe + - name: Upload Platform Package + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.save_url.outputs.upload_url }} + asset_path: runner/dist/codeql-runner-${{matrix.extension}} + asset_name: codeql-runner-${{matrix.extension}} + asset_content_type: application/octet-stream From c1e2c53b95daf192c2719b866defa86d145f8bca Mon Sep 17 00:00:00 2001 From: Robin Neatherway Date: Tue, 20 Oct 2020 11:56:08 +0100 Subject: [PATCH 3/4] Remove `push` trigger now that I've tested it works --- .github/workflows/build-runner.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-runner.yml b/.github/workflows/build-runner.yml index 216fe179b..22a4679da 100644 --- a/.github/workflows/build-runner.yml +++ b/.github/workflows/build-runner.yml @@ -1,7 +1,6 @@ name: Build runner on: - push: workflow_dispatch: inputs: bundle-tag: @@ -12,7 +11,7 @@ jobs: build-runner: runs-on: ubuntu-latest env: - RELEASE_TAG: test-build-runner # "${{ github.event.inputs.bundle-tag }}" + RELEASE_TAG: "${{ github.event.inputs.bundle-tag }}" strategy: matrix: From 269b8b9bae1eee5218cf3b0348141fe79722c421 Mon Sep 17 00:00:00 2001 From: Robin Neatherway Date: Tue, 20 Oct 2020 15:04:04 +0100 Subject: [PATCH 4/4] Update for review comments --- .../{build-runner.yml => release-runner.yml} | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) rename .github/workflows/{build-runner.yml => release-runner.yml} (80%) diff --git a/.github/workflows/build-runner.yml b/.github/workflows/release-runner.yml similarity index 80% rename from .github/workflows/build-runner.yml rename to .github/workflows/release-runner.yml index 22a4679da..e330a4b0f 100644 --- a/.github/workflows/build-runner.yml +++ b/.github/workflows/release-runner.yml @@ -1,4 +1,4 @@ -name: Build runner +name: Release runner on: workflow_dispatch: @@ -8,7 +8,7 @@ on: required: true jobs: - build-runner: + release-runner: runs-on: ubuntu-latest env: RELEASE_TAG: "${{ github.event.inputs.bundle-tag }}" @@ -20,7 +20,19 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Build runner + run: | + cd runner + npm install + npm run build-runner + + - uses: actions/upload-artifact@v2 + with: + name: codeql-runner-${{matrix.extension}} + path: runner/dist/codeql-runner-${{matrix.extension}} + - name: Resolve Upload URL for the release + if: ${{ github.event.inputs.bundle-tag != null }} id: save_url run: | UPLOAD_URL=$(curl -sS \ @@ -30,13 +42,8 @@ jobs: echo ${UPLOAD_URL} echo "::set-output name=upload_url::${UPLOAD_URL}" - - name: Build runner - run: | - cd runner - npm install - npm run build-runner - - name: Upload Platform Package + if: ${{ github.event.inputs.bundle-tag != null }} uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}