change the owner and repo name in lega-commander. #110
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
- 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: 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: Commit and Push Changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
BRANCH_NAME=${{ github.ref_name }} | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
for i in {1..3}; do | |
git pull https://${{ secrets.GITHUB_TOKEN }}@github.com/ELIXIR-NO/FEGA-Norway.git $BRANCH_NAME | |
git add -A | |
git commit -m "bump lega-commander version to ${{ steps.bump_lega_commander_version.outputs.new_lega_commander_version }}" | |
if git push https://${{ secrets.GITHUB_TOKEN }}@github.com/ELIXIR-NO/FEGA-Norway.git HEAD:refs/heads/$BRANCH_NAME; then | |
break | |
fi | |
sleep 5 | |
done | |
- 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 }}" | |