Enhancement/memory management #210
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: main | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- 'main' | |
types: [opened, synchronize] | |
pull_request_target: | |
branches: | |
- 'main' | |
types: [labeled] | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
if: > | |
${{ | |
github.event_name == 'pull_request' || | |
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe to test')) || | |
startsWith(github.ref, 'refs/tags/') | |
}} | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: lint | |
# Run ./gradlew spotlessApply when failing on this step. | |
run: ./gradlew spotlessCheck | |
- run: ./gradlew test | |
env: | |
EMBULK_OUTPUT_SNOWFLAKE_TEST_HOST: "${{ secrets.EMBULK_OUTPUT_SNOWFLAKE_TEST_HOST }}" | |
EMBULK_OUTPUT_SNOWFLAKE_TEST_USER: "${{ secrets.EMBULK_OUTPUT_SNOWFLAKE_TEST_USER }}" | |
EMBULK_OUTPUT_SNOWFLAKE_TEST_PASSWORD: "${{ secrets.EMBULK_OUTPUT_SNOWFLAKE_TEST_PASSWORD }}" | |
EMBULK_OUTPUT_SNOWFLAKE_TEST_WAREHOUSE: "${{ secrets.EMBULK_OUTPUT_SNOWFLAKE_TEST_WAREHOUSE }}" | |
EMBULK_OUTPUT_SNOWFLAKE_TEST_DATABASE: "${{ secrets.EMBULK_OUTPUT_SNOWFLAKE_TEST_DATABASE }}" | |
EMBULK_OUTPUT_SNOWFLAKE_TEST_SCHEMA: "${{ secrets.EMBULK_OUTPUT_SNOWFLAKE_TEST_SCHEMA }}" | |
- name: Show Current Version | |
run: ./gradlew printVersion | |
- name: Build Gem & Put it into './build/gems/' Directory | |
run: ./gradlew gem | |
- name: Set up JRuby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: jruby | |
- name: Publish to GPR | |
if: startsWith( github.ref, 'refs/tags/' ) | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} ./build/gems/*.gem | |
env: | |
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}" | |
OWNER: ${{ github.repository_owner }} | |
- name: Publish to RubyGems | |
if: startsWith( github.ref, 'refs/tags/' ) | |
run: | | |
mkdir -p $HOME/.gem | |
touch $HOME/.gem/credentials | |
chmod 0600 $HOME/.gem/credentials | |
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials | |
# TODO: If it is possible to accept input in the middle of a step, then the OTP Token should be inputted instead of generated. | |
gem install rotp -v 6.2.0 | |
OTP_TOKEN=$(echo ${OTP_SECRET} | ruby -rtime -rrotp -e "puts ROTP::TOTP.new(STDIN.read.chomp, issuer: 'rubygems.org').at(Time.now)") | |
gem push --otp="${OTP_TOKEN}" ./build/gems/*.gem | |
env: | |
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}" | |
OTP_SECRET: "${{secrets.RUBYGEMS_OTP_SECRET}}" |