diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ffa994..9e2e337 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,5 +32,5 @@ jobs: run: pnpm install - name: Release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} run: pnpm semantic-release diff --git a/.releaserc.json b/.releaserc.json index b84c9a6..e96c33c 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -7,7 +7,6 @@ ["@semantic-release/git", { "assets": ["package.json", "CHANGELOG.md"], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" - }], - "@semantic-release/github" + }] ] -} \ No newline at end of file +} diff --git a/action.yml b/action.yml index 7767e58..9a86f44 100644 --- a/action.yml +++ b/action.yml @@ -1,54 +1,52 @@ name: 'Setup Weld CLI' -description: 'Downloads a specific version of the weld CLI from a GitHub release, makes it executable, and adds it to the PATH.' +description: 'Downloads Weld CLI from Gitea releases and adds it to the PATH.' inputs: weld-version: - description: 'The version of weld to install (e.g., v0.2.0). Defaults to the latest release.' + description: 'Version to install (e.g., v0.2.0). Defaults to latest.' required: false default: 'latest' repo: - description: 'The repository where the weld CLI is released, in owner/repo format.' + description: 'The owner/repo on Gitea.' required: false - default: Xenox-Incorporated-Industries/weld + default: 'xenoxindustries/weld' token: - description: 'A GitHub token with read access to the weld repository releases.' + description: 'Gitea Personal Access Token (PAT).' required: true -branding: - icon: 'anchor' - color: 'blue' - runs: using: "composite" steps: - - name: Get Version Tag for Download + - name: Get Release Metadata id: get_version shell: bash - env: - GH_TOKEN: ${{ inputs.token }} run: | - VERSION_TAG="" + GITEA_URL="https://git.xenoxindustries.com" + if [[ "${{ inputs.weld-version }}" == "latest" ]]; then - echo "Figuring out the latest version..." - # Get the tag name of the latest release from the specified repo - VERSION_TAG=$(gh release view --repo ${{ inputs.repo }} --json tagName --jq .tagName) - echo "Latest version is ${VERSION_TAG}" + ENDPOINT="api/v1/repos/${{ inputs.repo }}/releases/latest" else - VERSION_TAG="${{ inputs.weld-version }}" - echo "Using specified version ${VERSION_TAG}" + ENDPOINT="api/v1/repos/${{ inputs.repo }}/releases/tags/${{ inputs.weld-version }}" fi - echo "tag=${VERSION_TAG}" >> $GITHUB_OUTPUT + + # Fetch release JSON from Gitea API + RESPONSE=$(curl -s -H "Authorization: token ${{ inputs.token }}" "$GITEA_URL/$ENDPOINT") + + # Extract Tag and Download URL for the asset named 'weld' + TAG=$(echo $RESPONSE | jq -r '.tag_name') + # This jq filter finds the asset named 'weld' and gets its download URL + DL_URL=$(echo $RESPONSE | jq -r '.assets[] | select(.name=="weld") | .browser_download_url') + + echo "tag=$TAG" >> $GITHUB_OUTPUT + echo "url=$DL_URL" >> $GITHUB_OUTPUT - name: Download Weld CLI shell: bash - env: - GH_TOKEN: ${{ inputs.token }} run: | - echo "Downloading weld version '${{ inputs.weld-version }}' from repo '${{ inputs.repo }}'..." - gh release download ${{ steps.get_version.outputs.tag }} \ - --repo ${{ inputs.repo }} \ - --pattern 'weld' \ - --output ./weld + echo "Downloading Weld from ${{ steps.get_version.outputs.url }}..." + curl -L -H "Authorization: token ${{ inputs.token }}" \ + -o ./weld \ + "${{ steps.get_version.outputs.url }}" echo "Download complete." - name: Make Weld CLI executable