From 8537131cd056f8a42e0b5193f8c1935905e9f062 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 20:49:55 +0530 Subject: [PATCH 1/8] chore(actions): include pesde package publishing action --- .github/workflows/publish.yml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e86f670 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +name: Publish + +on: + push: + tags: + - "v*" + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get version from tag + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Download pesde + run: | + # Figure out the latest release + latest_release=$(curl -s https://api.github.com/repos/daimond113/pesde/releases | jq '[.[] | select(.prerelease == true or .prerelease == false)][0]') + download_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith("linux-x86_64.tar.gz")) | .browser_download_url') + + # Download and extract the linux-x86_64 artifact + curl -L -o /tmp/pesde.tar.gz "$download_url" + tar -xzvf /tmp/pesde.tar.gz + chmod +x pesde + + # Install, cleanup and set PATH + ./pesde self-install + rm ./pesde + echo "$HOME/.pesde/bin" >> $GITHUB_PATH + + - name: Authenticate into pesde registry + run: | + echo '[tokens]' > $HOME/.pesde/config.toml + echo '"https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}"' >> $HOME/.pesde/config.toml + + - name: Update version + run: | + sed -i "s/version = .*/version = \"${{ steps.get_version.outputs.VERSION }}\"/" pesde.toml + + - name: Publish + run: pesde publish --dry-run From 63215da70b56f6df1db125283d3be9e455752097 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 21:02:59 +0530 Subject: [PATCH 2/8] chore(actions): avoid bumping in CI --- .github/workflows/publish.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e86f670..2fc76d2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,10 +12,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Get version from tag - id: get_version - run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - - name: Download pesde run: | # Figure out the latest release @@ -37,9 +33,5 @@ jobs: echo '[tokens]' > $HOME/.pesde/config.toml echo '"https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}"' >> $HOME/.pesde/config.toml - - name: Update version - run: | - sed -i "s/version = .*/version = \"${{ steps.get_version.outputs.VERSION }}\"/" pesde.toml - - name: Publish run: pesde publish --dry-run From bbbce960b08ceb333f8a5c6ee8b02a1ec8c5d7f2 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 21:08:14 +0530 Subject: [PATCH 3/8] chore(actions): set mandatory default registry for publishing --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2fc76d2..1fd206c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,6 +30,7 @@ jobs: - name: Authenticate into pesde registry run: | + echo -e "default_index = "https://github.com/daimond113/pesde-index"\n$(cat $HOME/.pesde/config.toml)" echo '[tokens]' > $HOME/.pesde/config.toml echo '"https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}"' >> $HOME/.pesde/config.toml From afe13e88191ad28c6219867c4c03536aaaed9297 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 21:10:10 +0530 Subject: [PATCH 4/8] chore(actions): actually redirect the default_index output lol --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1fd206c..4b22486 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,7 +30,7 @@ jobs: - name: Authenticate into pesde registry run: | - echo -e "default_index = "https://github.com/daimond113/pesde-index"\n$(cat $HOME/.pesde/config.toml)" + echo -e "default_index = "https://github.com/daimond113/pesde-index"\n$(cat $HOME/.pesde/config.toml)" > $HOME/.pesde/config.toml echo '[tokens]' > $HOME/.pesde/config.toml echo '"https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}"' >> $HOME/.pesde/config.toml From d9a7033d087c67b557431bf7f6370b2c9eaa1591 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 21:14:46 +0530 Subject: [PATCH 5/8] chore(actions): use cat heredoc for auth config instead --- .github/workflows/publish.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4b22486..0612c47 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,9 +30,12 @@ jobs: - name: Authenticate into pesde registry run: | - echo -e "default_index = "https://github.com/daimond113/pesde-index"\n$(cat $HOME/.pesde/config.toml)" > $HOME/.pesde/config.toml - echo '[tokens]' > $HOME/.pesde/config.toml - echo '"https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}"' >> $HOME/.pesde/config.toml + cat > $HOME/.pesde/config.toml << 'EOF' + default_index = "https://github.com/daimond113/pesde-index" + scripts_repo = "https://github.com/daimond113/pesde-scripts" + [tokens] + "https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}" + EOF - name: Publish run: pesde publish --dry-run From 487e3557c4b5bcbbdf6a0840aa704c9eeee9c0f5 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 21:16:22 +0530 Subject: [PATCH 6/8] chore(actions): use the builtin pesde command From 6627b2895a4e3a02b889c4f018772ea58ad69445 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 21:19:04 +0530 Subject: [PATCH 7/8] chore(actions): actually do the publish command --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0612c47..96b966a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -38,4 +38,4 @@ jobs: "https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}" EOF - name: Publish - run: pesde publish --dry-run + run: pesde publish -y From 58b1ecae3c75231b832c3bcbd7f1b96bc7c02f37 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Tue, 12 Nov 2024 21:20:03 +0530 Subject: [PATCH 8/8] chore(actions): use `pesde auth login` command instead of manually editing config --- .github/workflows/publish.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96b966a..c50ab00 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,13 +29,7 @@ jobs: echo "$HOME/.pesde/bin" >> $GITHUB_PATH - name: Authenticate into pesde registry - run: | - cat > $HOME/.pesde/config.toml << 'EOF' - default_index = "https://github.com/daimond113/pesde-index" - scripts_repo = "https://github.com/daimond113/pesde-scripts" + run: pesde auth login --token ${{ secrets.PESDE_TOKEN }} - [tokens] - "https://github.com/daimond113/pesde-index.git" = "${{ secrets.PESDE_TOKEN }}" - EOF - name: Publish run: pesde publish -y