Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TERRA-408] Move github files / packages #5

Merged
merged 6 commits into from
Mar 15, 2023
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
29 changes: 29 additions & 0 deletions .github/actions/bump-skip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This action must be done after the checkout action
name: 'bump-skip'
description: 'Set skip-out when we are doing a version bump'

inputs:
event-name:
required: true

outputs:
is-bump:
description: 'yes if this is a push made by bumper; no if it is a regular push'
value: ${{ steps.bumptest.outputs.is-bump }}

runs:
using: 'composite'
steps:
- name: Bump test
id: bumptest
run: |
log=$(git log --pretty='%B')
echo "log=$log"
pattern="^bump .*"
IS_BUMP=no
if [[ "${{ inputs.event-name }}" == "push" && "$log" =~ $pattern ]]; then
IS_BUMP=yes
fi
echo "IS_BUMP=$IS_BUMP"
echo is-bump=$IS_BUMP >> $GITHUB_OUTPUT
shell: bash
49 changes: 0 additions & 49 deletions .github/workflows/build-and-test.yml

This file was deleted.

File renamed without changes.
43 changes: 23 additions & 20 deletions .github/workflow/publish.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
name: development version bump
name: Publish
description: 'Publish to Artifactory'

# TODO: Set up publish-on-push when repo is ready
on:
workflow_dispatch: {}

workflow_call:
inputs:
subproject:
required: false
# default: "" # runs at root
artifactory_repo_key:
required: true

jobs:
publish_snapshot:
publish-job:
runs-on: ubuntu-latest

steps:
- name: Checkout current code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
java-version: 17

- name: Cache Gradle packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle') }}
restore-keys: v1-${{ runner.os }}-gradle-${{ hashfiles('**/gradle-wrapper.properties') }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build, assemble, and test
id: build-assemble-test
run: ./gradlew build
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@v1
with:
name: Test Reports
path: build/reports
# TODO: bump the version
- name: "Publish to Artifactory"
run: ./gradlew artifactoryPublish

- name: Publish to Artifactory
run: ./gradlew ${{ github.event.inputs.subproject }}:artifactoryPublish
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
ARTIFACTORY_REPO_KEY: "libs-snapshot-local"
ARTIFACTORY_REPO_KEY: ${{ github.event.inputs.artifactory_repo_key }}
20 changes: 20 additions & 0 deletions .github/workflows/tag-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Tag, publish, deploy

# TODO: Set up publish-on-push when repo is ready
on:
workflow_dispatch: {}
#push:
# branches: [ main ]
# paths-ignore: [ '**.md' ]

jobs:
tag:
uses: ./.github/workflows/tag.yml
secrets: inherit

publish:
needs: [ tag ]
uses: ./.github/workflows/publish.yml
secrets: inherit
with:
artifactory_repo_key: libs-snapshot-local
64 changes: 64 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Tag
description: 'Generate a tag'

on:
workflow_dispatch: {}

workflow_call:
inputs:
hotfix_branches:
required: false
default: hotfix.*
default_bump:
required: false
default: patch
release_branches:
required: false
default: main
version_file_path:
required: false
default: settings.gradle
version_line_match:
required: false
default: "^\\s*gradle.ext.releaseVersion\\s*=\\s*'.*'"
version_suffix:
required: false
default: SNAPSHOT

outputs:
tag:
description: 'Generated tag'
value: ${{ jobs.tag-job.outputs.tag }}

jobs:
tag-job:
runs-on: ubuntu-latest

outputs:
tag: ${{ steps.tag.outputs.tag }}
is-bump: ${{ steps.bump-skip.outputs.is-bump }}

steps:
- name: Checkout current code
uses: actions/checkout@v3
with:
token: ${{ secrets.BROADBOT_TOKEN }} # this allows the push to succeed later

- name: Skip version bump merges
id: bump-skip
uses: ./.github/actions/bump-skip
with:
event-name: ${{ github.event_name }}

- name: Bump the tag to a new version
# https://github.com/DataBiosphere/github-actions/tree/master/actions/bumper
uses: databiosphere/github-actions/actions/bumper@bumper-0.0.6
id: tag
env:
GITHUB_TOKEN: ${{ secrets.BROADBOT_TOKEN }}
HOTFIX_BRANCHES: ${{ github.event.inputs.hotfix_branches }}
DEFAULT_BUMP: ${{ github.event.inputs.default_bump }}
RELEASE_BRANCHES: ${{ github.event.inputs.release_branches }}
VERSION_FILE_PATH: ${{ github.event.inputs.version_file_path }}
VERSION_LINE_MATCH: ${{ github.event.inputs.version_line_match }}
VERSION_SUFFIX: ${{ github.event.inputs.version_suffix }}
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
plugins {
id 'idea'
id 'jacoco'
id 'java'
id 'java-library'
id 'maven-publish'

id 'com.diffplug.spotless' version '6.16.0'
id 'com.github.davidmc24.gradle.plugin.avro' version '1.6.0'
id 'com.github.spotbugs' version '5.0.13'
id 'com.jfrog.artifactory' version '4.31.5'
id 'com.github.davidmc24.gradle.plugin.avro' version '1.6.0'
}

// If true, search local repository (~/.m2/repository/) first for dependencies.
Expand All @@ -26,8 +27,6 @@ repositories {
}
}



java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
Expand All @@ -51,4 +50,3 @@ apply from: "$gradleIncDir/publishing.gradle"
apply from: "$gradleIncDir/spotbugs.gradle"
apply from: "$gradleIncDir/spotless.gradle"
apply from: "$gradleIncDir/testing.gradle"

Loading