├── .github └── FUNDING.yml ├── action.yml ├── Dockerfile └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | github: skx 3 | custom: https://steve.fi/donate/ 4 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'github-action-build' 2 | description: 'Build a project, creating artifacts' 3 | author: 'Steve Kemp' 4 | branding: 5 | icon: settings 6 | color: black 7 | inputs: 8 | builder: 9 | description: 'The path to the build-script to run, within the repository.' 10 | default: '.github/build' 11 | runs: 12 | using: 'docker' 13 | image: 'Dockerfile' 14 | args: 15 | - ${{ inputs.builder }} 16 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:latest 2 | 3 | LABEL "com.github.actions.name"="github-action-build" 4 | LABEL "com.github.actions.description"="Run a repository-specific build-script" 5 | LABEL "com.github.actions.icon"="settings" 6 | LABEL "com.github.actions.color"="gray-dark" 7 | 8 | LABEL version="1.0.0" 9 | LABEL repository="http://github.com/skx/github-action-build" 10 | LABEL homepage="http://github.com/skx/github-action-build" 11 | LABEL maintainer="Steve Kemp " 12 | 13 | COPY build /usr/local/bin/build 14 | 15 | ENTRYPOINT ["/usr/local/bin/build"] 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action for building a project 2 | 3 | This repository contains a simple GitHub Action implementation, which allows you to build your project, in a repository-specific fashion. 4 | 5 | The expectation is that you would create an action-based workflow: 6 | 7 | * Checkout the code. 8 | * Run the tests. 9 | * Run the build, generating your artifacts. 10 | * Upload the artifacts. 11 | * Perhaps using my [github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries/) action. 12 | 13 | 14 | ## Enabling the action 15 | 16 | There are two steps required to use this action: 17 | 18 | * Enable the action inside your repository. 19 | * This might mean creating a file `.github/workflows/release.yml` which is where the action is invoked for release-steps, for example. 20 | * Add your project-specific `.github/build` script. 21 | * This is the script which will actually carry out your build-steps. 22 | * A C-project might just run `make`. 23 | * A golang-based project might run `go build .` multiple times for different architectures. 24 | 25 | 26 | ## Sample Configuration 27 | 28 | This configuration runs the script `.github/build` every time a release is made of your project, and is defined in the file `.github/workflows/release.yml`: 29 | 30 | ```yml 31 | on: 32 | release: 33 | types: [created] 34 | name: Handle Release 35 | jobs: 36 | generate: 37 | name: Create release-artifacts 38 | runs-on: ubuntu-latest 39 | steps: 40 | - uses: actions/checkout@master 41 | - name: Generate 42 | uses: skx/github-action-build@master 43 | with: 44 | builder: .github/build 45 | ``` 46 | 47 | We assume that the `.github/build` script generated a series of binaries, and these can be acccessed by later steps in your workflow. For example you might use my uploading-action: 48 | 49 | * [https://github.com/skx/github-action-publish-binaries](https://github.com/skx/github-action-publish-binaries) 50 | 51 | Of course you can specify a different script name, via the `builder` argument in your workflow file. 52 | --------------------------------------------------------------------------------