From 4012718f9bfa137186ee05a5ec036e9fb57f4848 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 17:02:54 -0700 Subject: [PATCH 1/5] Update latest-release workflow --- .github/actions/latest-release/action.yml | 26 +++++++++++++++++ .github/workflows/latest-release.yml | 34 ++++++----------------- 2 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 .github/actions/latest-release/action.yml diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml new file mode 100644 index 0000000000..e283e8ed01 --- /dev/null +++ b/.github/actions/latest-release/action.yml @@ -0,0 +1,26 @@ +name: Latest release +description: Report the latest release of the current repo +runs: + using: "composite" + steps: + - name: Install semver-tool + run: | + wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver + chmod +x /usr/local/bin/semver + semver --version + - name: Fetch all tags + run: git fetch --all --tags + - name: Fetch latest-release script + run: | + wget https://raw.githubusercontent.com/lf-lang/lingua-franca/master/.github/scripts/latest-release.sh + chmod +x latest-release.sh + - name: Find the latest release + id: find + run: | + export tag=$(./latest-release.sh) + echo "ref=${tag}" >> $GITHUB_OUTPUT + shopt -s extglob + export ver="${tag##v}" + echo "ver=${ver}" >> $GITHUB_OUTPUT + echo "Latest release tag: ${tag}" + echo "Without a leading 'v': ${ver}" diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.yml index d327f8f722..900df0f843 100644 --- a/.github/workflows/latest-release.yml +++ b/.github/workflows/latest-release.yml @@ -10,10 +10,10 @@ on: outputs: ref: description: "The tag of the latest release" - value: ${{ jobs.run.outputs.ref }} + value: ${{ jobs.get-latest-release.outputs.ref }} ver: description: "The semver of the latest release (without a leading 'v')" - value: ${{ jobs.run.outputs.ver }} + value: ${{ jobs.get-latest-release.outputs.ver }} # Also allow trigging the workflow manually. workflow_dispatch: @@ -21,31 +21,13 @@ jobs: get-latest-release: runs-on: ubuntu-latest outputs: - ref: ${{ steps.find.outputs.ref }} - ver: ${{ steps.find.outputs.ver }} + ref: ${{ steps.semver.outputs.ref }} + ver: ${{ steps.semver.outputs.ver }} steps: - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: lf-lang/${{ inputs.repo }} - - name: Install semver-tool - run: | - wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver - chmod +x /usr/local/bin/semver - semver --version - - name: Fetch all tags - run: git fetch --all --tags - - name: Fetch latest-release script - run: | - wget https://raw.githubusercontent.com/lf-lang/lingua-franca/master/.github/scripts/latest-release.sh - chmod +x latest-release.sh - - name: Find the latest release - id: find - run: | - export tag=$(./latest-release.sh) - echo "{ref}={${tag}}" >> $GITHUB_OUTPUT - shopt -s extglob - export ver="${tag##v}" - echo "{ver}={${ver}}" >> $GITHUB_OUTPUT - echo "Latest release tag: ${tag}" - echo "Without a leading 'v': ${ver}" + - id: semver + uses: ./.github/actions/latest-release@master + \ No newline at end of file From fa9e2e5e13e85d2d74072a25665a8d689deab153 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 17:05:13 -0700 Subject: [PATCH 2/5] Get input from user with invoked manually --- .github/workflows/latest-release.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.yml index 900df0f843..7882968990 100644 --- a/.github/workflows/latest-release.yml +++ b/.github/workflows/latest-release.yml @@ -16,6 +16,11 @@ on: value: ${{ jobs.get-latest-release.outputs.ver }} # Also allow trigging the workflow manually. workflow_dispatch: + inputs: + repo: + type: string + description: Repo to find the latest release of + default: lingua-franca jobs: get-latest-release: @@ -27,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@v3 with: - repository: lf-lang/${{ inputs.repo }} + repository: lf-lang/${{ github.event.inputs.repo || inputs.repo }} - id: semver uses: ./.github/actions/latest-release@master \ No newline at end of file From 35f74a6297ac4b966633137f54e8061b2fb851a3 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 17:36:16 -0700 Subject: [PATCH 3/5] Add option to specify different repo owner --- .github/actions/latest-release/action.yml | 4 ++++ .github/workflows/latest-release.yml | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml index e283e8ed01..98c51bb900 100644 --- a/.github/actions/latest-release/action.yml +++ b/.github/actions/latest-release/action.yml @@ -8,12 +8,15 @@ runs: wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver chmod +x /usr/local/bin/semver semver --version + shell: bash - name: Fetch all tags run: git fetch --all --tags + shell: bash - name: Fetch latest-release script run: | wget https://raw.githubusercontent.com/lf-lang/lingua-franca/master/.github/scripts/latest-release.sh chmod +x latest-release.sh + shell: bash - name: Find the latest release id: find run: | @@ -24,3 +27,4 @@ runs: echo "ver=${ver}" >> $GITHUB_OUTPUT echo "Latest release tag: ${tag}" echo "Without a leading 'v': ${ver}" + shell: bash diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.yml index 7882968990..cdd65f59f1 100644 --- a/.github/workflows/latest-release.yml +++ b/.github/workflows/latest-release.yml @@ -3,6 +3,10 @@ name: Latest release on: workflow_call: inputs: + owner: + type: string + description: Owner of the repo + default: lf-lang repo: type: string description: Repo to find the latest release of @@ -14,9 +18,13 @@ on: ver: description: "The semver of the latest release (without a leading 'v')" value: ${{ jobs.get-latest-release.outputs.ver }} - # Also allow trigging the workflow manually. + workflow_dispatch: inputs: + owner: + type: string + description: Owner of the repo + default: lf-lang repo: type: string description: Repo to find the latest release of @@ -32,7 +40,6 @@ jobs: - name: Check out repository uses: actions/checkout@v3 with: - repository: lf-lang/${{ github.event.inputs.repo || inputs.repo }} + repository: ${{ github.event.inputs.owner || inputs.owner }}/${{ github.event.inputs.repo || inputs.repo }} - id: semver - uses: ./.github/actions/latest-release@master - \ No newline at end of file + uses: lf-lang/lingua-franca/.github/actions/latest-release@ci-stuff From cfa80a298adaa50fe4ab9b49b76ca8d428d1c6dc Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 22:02:48 -0700 Subject: [PATCH 4/5] Set outputs accordingly --- .github/actions/latest-release/action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml index 98c51bb900..8d78884008 100644 --- a/.github/actions/latest-release/action.yml +++ b/.github/actions/latest-release/action.yml @@ -1,5 +1,14 @@ name: Latest release description: Report the latest release of the current repo +outputs: + outputs: + ref: + value: ${{ steps.find.outputs.ref }} + description: The latest semver tag + ver: + value: ${{ steps.find.outputs.ver }} + description: The semver corresponding to the latest semver tag + runs: using: "composite" steps: From c99a0f9a88bb21828eb3b1264be79756d9d9baaa Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 22:14:27 -0700 Subject: [PATCH 5/5] Yaml is not a programming language --- .github/actions/latest-release/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml index 8d78884008..910da91c03 100644 --- a/.github/actions/latest-release/action.yml +++ b/.github/actions/latest-release/action.yml @@ -1,7 +1,6 @@ name: Latest release description: Report the latest release of the current repo outputs: - outputs: ref: value: ${{ steps.find.outputs.ref }} description: The latest semver tag