简体   繁体   中英

Github - Commit artifact to repository

I am working with drools and wanting a workflow to trigger an Ant build on pull request and save the produced jar file to the repository.

I have got so far as to running the ant build and producing the artifact but is there any way to commit that file back into the repo as part of the pull request.

# This is a basic workflow to help you get started with Actions

name: Run ant build

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the production branch
  pull_request:
    branches:
      - production
      - develop

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
        with:
          java-version: '11'
          distribution: 'adopt'

      - run: ant -noinput -buildfile satbuild.xml
      - uses: actions/upload-artifact@v2
        with:
          name: fileName
          path: fileName.jar

If you really want to save artifacts, then you should look into git-lfs . However, committing binaries to a repository is generally considered bad practice. If you need it as part of your build, consider hosting it on GitHub Packages .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM