Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Instructions/compatibility with GitHub Actions #842

Open
magneticflux- opened this issue Aug 20, 2019 · 2 comments
Open

Instructions/compatibility with GitHub Actions #842

magneticflux- opened this issue Aug 20, 2019 · 2 comments

Comments

@magneticflux-
Copy link
Contributor

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.

@aepfli
Copy link

aepfli commented May 2, 2020

Just an fyi, we (https://github.com/junit-pioneer/junit-pioneer) migrated now from travis to github actions. it is working with some "hacks".

  1. shipkit relies on the environment variable TRAVIS_BRANCH to work successfully, but this can be easily injected
  2. github.ref which contains the branch contains it with refs/head/ in the beginning, which cause troubles and needs to be split

our 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 junit-pioneer/junit-pioneer#199

@mstachniuk
Copy link
Contributor

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants