Open magneticflux- opened 5 years ago
Just an fyi, we (https://github.com/junit-pioneer/junit-pioneer) migrated now from travis to github actions. it is working with some "hacks".
TRAVIS_BRANCH
to work successfully, but this can be easily injectedgithub.ref
which contains the branch contains it with refs/head/
in the beginning, which cause troubles and needs to be splitour deploy action look like
deploy:
needs: build
runs-on: ubuntu-latest
name: Deploy with Shipkit
if: github.ref == 'refs/heads/master'
steps:
- name: Sanitize Branch
uses: frabert/replace-string-action@master
id: gitbranch
with:
pattern: 'refs/heads/(.*)'
string: "${{ github.ref }}"
replace-with: '$1'
- uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: 8
- name: Perform Release
uses: eskatos/gradle-command-action@v1
env:
TRAVIS_BRANCH: ${{ steps.gitbranch.outputs.replaced }}
TRAVIS_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
TRAVIS_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
GH_WRITE_TOKEN: ${{ secrets.GH_WRITE_TOKEN }}
BINTRAY_USER_NAME: ${{ secrets.BINTRAY_USER_NAME }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
NEXUS_TOKEN_USERNAME: ${{ secrets.NEXUS_TOKEN_USERNAME }}
NEXUS_TOKEN_PASSWORD: ${{ secrets.NEXUS_TOKEN_PASSWORD }}
with:
arguments: ciPerformRelease
and in our shipkit.gradle we added some parameters so that CI is correctly linked.
see https://github.com/junit-pioneer/junit-pioneer/issues/199
I created an example project for that issue: https://github.com/mstachniuk/shipkit-gh-actions-example
It's a little bit complicated but works better in case of setting TRAVIS_BRANCH
for Pull Request build.
Using just TRAVIS_BRANCH: ${{ steps.gitbranch.outputs.replaced }}
sets it to refs/pull/7/merge
but Travis sets it to the real PR source branch.
Because of https://github.com/mockito/shipkit/blob/master/docs/design-specs/future-shipkit.md there is no plan yet (nor volunteers) to support GitHub Actions and other CI systems. Instead, we started extracting the most important features to the separates plugins, e.g.: https://github.com/shipkit/shipkit-auto-version & https://github.com/shipkit/shipkit-changelog . Those plugins should have more configurations options. Someday Shipkit will use those plugins (hopefully).
Now that GitHub Actions is in beta and more people are getting access to it, it makes sense to broaden the compatible CI environments for ShipKit.