Skip to content

add lega-cmdr to release.yml #101

add lega-cmdr to release.yml

add lega-cmdr to release.yml #101

Workflow file for this run

name: Publish
on:
push:
jobs:
# detect_changes:
# runs-on: ubuntu-latest
# outputs:
# outputs:
# lega-commander: ${{ steps.changes.outputs.lega-commander }}
# e2eTests: ${{ steps.changes.outputs.e2eTests }}
# clearinghouse: ${{ steps.changes.outputs.clearinghouse }}
# crypt4gh: ${{ steps.changes.outputs.crypt4gh }}
# tsd-file-api-client: ${{ steps.changes.outputs.tsd-file-api-client }}
# lega-commander: ${{ steps.changes.outputs.lega-commander }}
# tsd_api_mock: ${{ steps.changes.outputs.tsd_api_mock }}
# lega-commander: ${{ steps.changes.outputs.lega-commander }}
# tsd_api_mock: ${{ steps.changes.outputs.tsd_api_mock }}
# steps:
# - uses: actions/checkout@v4
# - uses: dorny/paths-filter@v3
# id: changes
# with:
# filters: |
# lega-commander:
# - 'cli/lega-commander/**'
# e2eTests:
# - 'e2eTests/**'
# clearinghouse:
# - 'lib/clearinghouse/**'
# crypt4gh:
# - 'lib/crypt4gh/**'
# tsd-file-api-client:
# - 'lib/tsd-file-api-client/**'
# lega-commander:
# - 'services/lega-commander/**'
# tsd_api_mock:
# - 'services/tsd_api_mock/**'
# lega-commander:
# - 'services/lega-commander/**'
# tsd_api_mock:
# - 'services/tsd_api_mock/**'
#
#
publish-lega-commander:
# needs: detect_changes
# if: needs.detect_changes.outputs.lega-commander == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
id: go
- uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: Get dependencies
# run: |
# cd cli/lega-commander
# go get -v -t -d ./...
# if [ -f Gopkg.toml ]; then
# curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
# dep ensure
# fi
# - name: Clean up go.mod and go.sum
# run: |
# cd cli/lega-commander
# go mod tidy
- name: Get current version for lega-commander
id: version_lega_commander
run: |
LEGA_COMMANDER_VERSION=$(grep -oP 'version = "\K[0-9]+\.[0-9]+\.[0-9]+' cli/lega-commander/build.gradle.kts)
echo "lega_commander_version=$LEGA_COMMANDER_VERSION" >> $GITHUB_OUTPUT
- name: Bump patch version for lega-commander
id: bump_lega_commander_version
run: |
LEGA_COMMANDER_VERSION="${{ steps.version_lega_commander.outputs.lega_commander_version }}"
VERSION_PARTS=(${LEGA_COMMANDER_VERSION//./ })
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
PATCH=$((PATCH + 1))
NEW_LEGA_COMMANDER_VERSION="$MAJOR.$MINOR.$PATCH"
echo "new_lega_commander_version=$NEW_LEGA_COMMANDER_VERSION" >> $GITHUB_OUTPUT
# - name: Create and push new tag
# run: |
# git tag v${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }} ${{ github.sha }}
# git push origin v${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }}
#
# - name: Export goreleaser tags
# run: |
# echo "GORELEASER_CURRENT_TAG=v${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }}" >> $GITHUB_ENV
# echo "GORELEASER_PREVIOUS_TAG=v${{ steps.version_lega_commander.outputs.lega_commander_version }}" >> $GITHUB_ENV
#
# - name: Fetch tags before running GoReleaser
# run: git fetch --tags
#
# - name: Run GoReleaser
# uses: goreleaser/goreleaser-action@v6
# with:
# version: latest
# args: release --clean
# workdir: cli/lega-commander
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install GoReleaser
run: |
curl -sL https://git.io/goreleaser | bash
- name: Run GoReleaser with Custom Tag
run: |
goreleaser release --rm-dist --skip-publish --snapshot --release-notes "Release for version ${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update version in lega-commander's build.gradle.kts
run: sed -i "s#version = \".*\"#version = \"${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }}\"#" cli/lega-commander/build.gradle.kts
# - name: Create GitHub release
# if: success()
# uses: softprops/action-gh-release@v2
# with:
# target_commitish: ${{ github.head_ref || github.ref_name }}
# token: "${{ secrets.GITHUB_TOKEN }}"
# tag_name: "lega-commander-${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }}"
# prerelease: false
# name: "Lega-commander-${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }}"