Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/auto-release-cfl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto Release cfl

on:
push:
branches: [main]
paths:
- 'tools/cfl/**/*.go'
- 'tools/cfl/go.mod'
- 'tools/cfl/go.sum'

jobs:
create-tag:
runs-on: ubuntu-latest
# Only create release for feat: or fix: commits
if: startsWith(github.event.head_commit.message, 'feat:') || startsWith(github.event.head_commit.message, 'fix:')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.TAP_GITHUB_TOKEN }}

- name: Read version
id: version
run: |
BASE_VERSION=$(cat tools/cfl/version.txt | tr -d '\n')
VERSION="${BASE_VERSION}.${{ github.run_number }}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "cfl-v${{ steps.version.outputs.version }}" -m "Release cfl v${{ steps.version.outputs.version }}"
git push origin "cfl-v${{ steps.version.outputs.version }}"
35 changes: 35 additions & 0 deletions .github/workflows/auto-release-jtk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto Release jtk

on:
push:
branches: [main]
paths:
- 'tools/jtk/**/*.go'
- 'tools/jtk/go.mod'
- 'tools/jtk/go.sum'

jobs:
create-tag:
runs-on: ubuntu-latest
# Only create release for feat: or fix: commits
if: startsWith(github.event.head_commit.message, 'feat:') || startsWith(github.event.head_commit.message, 'fix:')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.TAP_GITHUB_TOKEN }}

- name: Read version
id: version
run: |
BASE_VERSION=$(cat tools/jtk/version.txt | tr -d '\n')
VERSION="${BASE_VERSION}.${{ github.run_number }}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "jtk-v${{ steps.version.outputs.version }}" -m "Release jtk v${{ steps.version.outputs.version }}"
git push origin "jtk-v${{ steps.version.outputs.version }}"
60 changes: 60 additions & 0 deletions .github/workflows/chocolatey-publish-cfl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Chocolatey Publish cfl

on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 0.9.150)'
required: true
type: string

jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Download release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$version = "${{ inputs.version }}"
$tag = "cfl-v$version"
gh release download $tag --pattern "cfl_${version}_windows_*.zip" --pattern "checksums.txt" --dir artifacts

- name: Extract checksums
run: |
$version = "${{ inputs.version }}"
$checksums = Get-Content artifacts/checksums.txt
$amd64 = ($checksums | Select-String "cfl_${version}_windows_amd64.zip").ToString().Split(" ")[0]
$arm64 = ($checksums | Select-String "cfl_${version}_windows_arm64.zip").ToString().Split(" ")[0]
echo "CHECKSUM_AMD64=$amd64" >> $env:GITHUB_ENV
echo "CHECKSUM_ARM64=$arm64" >> $env:GITHUB_ENV

- name: Update nuspec version
run: |
$version = "${{ inputs.version }}"
$nuspec = Get-Content tools/cfl/packaging/chocolatey/confluence-cli.nuspec
$nuspec = $nuspec -replace '<version>.*</version>', "<version>$version</version>"
$nuspec | Set-Content tools/cfl/packaging/chocolatey/confluence-cli.nuspec

- name: Update install script checksums
run: |
$script = Get-Content tools/cfl/packaging/chocolatey/tools/chocolateyInstall.ps1
$script = $script -replace "CHECKSUM_AMD64_PLACEHOLDER", $env:CHECKSUM_AMD64
$script = $script -replace "CHECKSUM_ARM64_PLACEHOLDER", $env:CHECKSUM_ARM64
$script | Set-Content tools/cfl/packaging/chocolatey/tools/chocolateyInstall.ps1

- name: Update install script URLs
run: |
$version = "${{ inputs.version }}"
$script = Get-Content tools/cfl/packaging/chocolatey/tools/chocolateyInstall.ps1
$script = $script -replace 'https://github.com/open-cli-collective/confluence-cli/', 'https://github.com/open-cli-collective/atlassian-cli/'
$script = $script -replace '/v\$\{version\}', "/cfl-v`${version}"
$script | Set-Content tools/cfl/packaging/chocolatey/tools/chocolateyInstall.ps1

- name: Pack and push
run: |
cd tools/cfl/packaging/chocolatey
choco pack
choco push confluence-cli.${{ inputs.version }}.nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.CHOCOLATEY_API_KEY }}
60 changes: 60 additions & 0 deletions .github/workflows/chocolatey-publish-jtk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Chocolatey Publish jtk

on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 0.1.75)'
required: true
type: string

jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Download release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$version = "${{ inputs.version }}"
$tag = "jtk-v$version"
gh release download $tag --pattern "jtk_${version}_windows_*.zip" --pattern "checksums.txt" --dir artifacts

- name: Extract checksums
run: |
$version = "${{ inputs.version }}"
$checksums = Get-Content artifacts/checksums.txt
$amd64 = ($checksums | Select-String "jtk_${version}_windows_amd64.zip").ToString().Split(" ")[0]
$arm64 = ($checksums | Select-String "jtk_${version}_windows_arm64.zip").ToString().Split(" ")[0]
echo "CHECKSUM_AMD64=$amd64" >> $env:GITHUB_ENV
echo "CHECKSUM_ARM64=$arm64" >> $env:GITHUB_ENV

- name: Update nuspec version
run: |
$version = "${{ inputs.version }}"
$nuspec = Get-Content tools/jtk/packaging/chocolatey/jira-ticket-cli.nuspec
$nuspec = $nuspec -replace '<version>.*</version>', "<version>$version</version>"
$nuspec | Set-Content tools/jtk/packaging/chocolatey/jira-ticket-cli.nuspec

- name: Update install script checksums
run: |
$script = Get-Content tools/jtk/packaging/chocolatey/tools/chocolateyInstall.ps1
$script = $script -replace "CHECKSUM_AMD64_PLACEHOLDER", $env:CHECKSUM_AMD64
$script = $script -replace "CHECKSUM_ARM64_PLACEHOLDER", $env:CHECKSUM_ARM64
$script | Set-Content tools/jtk/packaging/chocolatey/tools/chocolateyInstall.ps1

- name: Update install script URLs
run: |
$version = "${{ inputs.version }}"
$script = Get-Content tools/jtk/packaging/chocolatey/tools/chocolateyInstall.ps1
$script = $script -replace 'https://github.com/open-cli-collective/jira-ticket-cli/', 'https://github.com/open-cli-collective/atlassian-cli/'
$script = $script -replace '/v\$\{version\}', "/jtk-v`${version}"
$script | Set-Content tools/jtk/packaging/chocolatey/tools/chocolateyInstall.ps1

- name: Pack and push
run: |
cd tools/jtk/packaging/chocolatey
choco pack
choco push jira-ticket-cli.${{ inputs.version }}.nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.CHOCOLATEY_API_KEY }}
80 changes: 52 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,77 @@ on:
pull_request:

jobs:
build-and-test:
detect-changes:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.24']

outputs:
cfl: ${{ steps.filter.outputs.cfl }}
jtk: ${{ steps.filter.outputs.jtk }}
shared: ${{ steps.filter.outputs.shared }}
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
- uses: dorny/paths-filter@v3
id: filter
with:
go-version: ${{ matrix.go-version }}

- name: Verify go.work
run: go work sync
filters: |
cfl:
- 'tools/cfl/**'
jtk:
- 'tools/jtk/**'
shared:
- 'shared/**'

build-test-cfl:
needs: detect-changes
if: needs.detect-changes.outputs.cfl == 'true' || needs.detect-changes.outputs.shared == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Build cfl
run: go build -v ./tools/cfl/cmd/cfl

- name: Build jtk
run: go build -v ./tools/jtk/cmd/jtk

run: go build -v ./tools/cfl/...
- name: Test cfl
run: go test -v ./tools/cfl/...
run: go test -v -race -coverprofile=coverage-cfl.out ./tools/cfl/...

build-test-jtk:
needs: detect-changes
if: needs.detect-changes.outputs.jtk == 'true' || needs.detect-changes.outputs.shared == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Build jtk
run: go build -v ./tools/jtk/...
- name: Test jtk
run: go test -v ./tools/jtk/...
run: go test -v -race -coverprofile=coverage-jtk.out ./tools/jtk/...

lint:
lint-cfl:
needs: detect-changes
if: needs.detect-changes.outputs.cfl == 'true' || needs.detect-changes.outputs.shared == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
with:
go-version: '1.24'

- name: golangci-lint cfl
uses: golangci/golangci-lint-action@v6
- uses: golangci/golangci-lint-action@v7
with:
working-directory: tools/cfl
version: v2.0.2

- name: golangci-lint jtk
uses: golangci/golangci-lint-action@v6
lint-jtk:
needs: detect-changes
if: needs.detect-changes.outputs.jtk == 'true' || needs.detect-changes.outputs.shared == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.24'
- uses: golangci/golangci-lint-action@v7
with:
working-directory: tools/jtk
version: v2.0.2
Loading
Loading