Skip to content

Commit

Permalink
add push job
Browse files Browse the repository at this point in the history
  • Loading branch information
Parisa68 committed Sep 24, 2024
1 parent a8eac9d commit cea3494
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 106 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,21 @@ jobs:
tag_name: "tsd-file-api-client-${{ steps.bump_tsd-file-api-client_version.outputs.new_tsd-file-api-client_version }}"
prerelease: false
name: "Tsd-file-api-client-${{ steps.bump_tsd-file-api-client_version.outputs.new_tsd-file-api-client_version }}"
push_new_versions:
runs-on: ubuntu-latest
steps:
- name: Commit and Push Changes
if: steps.format.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME=${{ github.head_ref }}
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add -A
git commit -m "bump versions"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/ELIXIR-NO/FEGA-Norway.git HEAD:refs/heads/$BRANCH_NAME
166 changes: 63 additions & 103 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,111 +1,71 @@
name: Release to GitHub
on:
# push:
# # branches: [ main ]
# # paths:
# # - "lib/**"
# # - "services/**"
# # - "buildSrc/**"
# # - "cli/**"
# workflow_run:
# workflows: [ "Publish packages" ]
# types:
# - completed
jobs:
detect_changes:
runs-on: ubuntu-latest
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 }}
cega-mock: ${{ steps.changes.outputs.cega-mock }}
localega-tsd-proxy: ${{ steps.changes.outputs.localega-tsd-proxy }}
mq-interceptor: ${{ steps.changes.outputs.mq-interceptor }}
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/**'
cega-mock:
- 'services/cega-mock/**'
localega-tsd-proxy:
- 'services/localega-tsd-proxy/**'
mq-interceptor:
- 'services/mq-interceptor/**'
tsd-api-mock:
- 'services/tsd-api-mock/**'
publish-tsd-file-api-client:
needs: detect_changes
if: needs.detect_changes.outputs.tsd-file-api-client == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'

release_fega_norway:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/[email protected]

- name: Setup Gradle
uses: gradle/actions/[email protected]
- name: Get current version for tsd-file-api-client
id: version_tsd-file-api-client
run: |
TSD-FILE-API-ClIENT_VERSION=$(grep -oP 'version = "\K[0-9]+\.[0-9]+\.[0-9]+' lib/tsd-file-api-client/build.gradle.kts)
echo "tsd-file-api-client_version=$TSD-FILE-API-ClIENT_VERSION" >> $GITHUB_OUTPUT
- name: Get current version of fega-norway
id: version_fega-norway
run: |
FEGA_NORWAY_VERSION=$(grep -oP 'version = "\K[0-9]+\.[0-9]+\.[0-9]+' build.gradle.kts)
echo "fega-norway_version=$FEGA_NORWAY_VERSION" >> $GITHUB_OUTPUT
- name: Bump patch version for tsd-file-api-client
id: bump_tsd-file-api-client_version
run: |
TSD-FILE-API-ClIENT_VERSION="${{ steps.version_tsd-file-api-client.outputs.tsd-file-api-client_version }}"
VERSION_PARTS=(${TSD-FILE-API-ClIENT_VERSION//./ })
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
# Increment the patch version
PATCH=$((PATCH + 1))
NEW_TSD-FILE-API-ClIENT_VERSION="$MAJOR.$MINOR.$PATCH"
echo "new_tsd-file-api-client_version=$NEW_TSD-FILE-API-ClIENT_VERSION" >> $GITHUB_OUTPUT
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: ${{ steps.version_fega-norway.outputs.fega-norway_version }}
prerelease: false
name: "FEGA Norway-${{ steps.version_fega-norway.outputs.fega-norway_version }}"
- name: Update version in tsd-file-api-client's build.gradle.kts
run: sed -i "s#version = \".*\"#version = \"${{ steps.bump_tsd-file-api-client_version.outputs.new_tsd-file-api-client_version }}\"#" lib/tsd-file-api-client/build.gradle.kts

release_clearinghouse:
needs: detect_changes
if: needs.detect_changes.outputs.clearinghouse == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Release tsd-file-api-client
run: |
./gradlew :lib:tsd-file-api-client:build
./gradlew :lib:tsd-file-api-client:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# - name: Commit and Push Changes
# if: steps.format.outputs.changes == 'true'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# BRANCH_NAME=${{ github.head_ref }}
# git config --global user.name 'GitHub Actions'
# git config --global user.email '[email protected]'
# git add -A
# git commit -m "Code formatting applied"
# git push https://${{ secrets.GITHUB_TOKEN }}@github.com/ELIXIR-NO/FEGA-Norway.git HEAD:refs/heads/$BRANCH_NAME

- name: Setup Gradle
uses: gradle/actions/[email protected]

- name: Get current version for clearinghouse
id: version_clearinghouse
run: |
CLEARINGHOUSE_VERSION=$(grep -oP 'version = "\K[0-9]+\.[0-9]+\.[0-9]+' lib/clearinghouse/build.gradle.kts)
echo "clearinghouse_version=$CLEARINGHOUSE_VERSION" >> $GITHUB_OUTPUT
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
target_commitish: ${{ github.head_ref || github.ref_name }}
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "clearinghouse-${{ steps.version_clearinghouse.outputs.clearinghouse_version }}"
prerelease: false
name: "Clearinghouse-${{ steps.version_clearinghouse.outputs.clearinghouse_version }}"
- 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: "tsd-file-api-client-${{ steps.bump_tsd-file-api-client_version.outputs.new_tsd-file-api-client_version }}"
prerelease: false
name: "Tsd-file-api-client-${{ steps.bump_tsd-file-api-client_version.outputs.new_tsd-file-api-client_version }}"
2 changes: 1 addition & 1 deletion lib/clearinghouse/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "no.elixir"
version = "13.0.10"
version = "13.0.15"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion lib/crypt4gh/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "no.elixir"
version = "3.0.11"
version = "3.0.15"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion lib/tsd-file-api-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "elixir.no"
version = "2.0.11"
version = "2.0.15"

repositories {
mavenCentral()
Expand Down

0 comments on commit cea3494

Please sign in to comment.