|  | 
|  | 1 | +name: Continuous Integration | 
|  | 2 | +on: | 
|  | 3 | + pull_request: | 
|  | 4 | +   types: [opened, synchronize, reopened] | 
|  | 5 | + push: | 
|  | 6 | +   branches: | 
|  | 7 | +     - master | 
|  | 8 | + | 
|  | 9 | +jobs: | 
|  | 10 | +  report: | 
|  | 11 | +    name: Report | 
|  | 12 | +    runs-on: ubuntu-latest | 
|  | 13 | +    steps: | 
|  | 14 | +    - name: ref | 
|  | 15 | +      run: echo ${{ github.ref }} | 
|  | 16 | +    - name: event_name | 
|  | 17 | +      run: echo ${{ github.event_name }} | 
|  | 18 | +  build: | 
|  | 19 | +    name: Build | 
|  | 20 | +    runs-on: ubuntu-latest | 
|  | 21 | +    steps: | 
|  | 22 | +    - name: checkout | 
|  | 23 | +      uses: actions/checkout@v2 | 
|  | 24 | +    - uses: actions/setup-go@v2 | 
|  | 25 | +      with: | 
|  | 26 | +        go-version: '1.14.2' # The Go version to download (if necessary) and use. | 
|  | 27 | +    - name: kubebuilder-env | 
|  | 28 | +      run: echo "::set-env name=KUBEBUILDER_DIR::/tmp/kubebuilder_install" | 
|  | 29 | +    - name: kubebuilder | 
|  | 30 | +      run: make kubebuilder KUBEBUILDER_DIR=${KUBEBUILDER_DIR} # we use this dir because /usr/local/kubebuilder is protected | 
|  | 31 | +    - name: test | 
|  | 32 | +      run: make test KUBEBUILDER_DIR=${KUBEBUILDER_DIR} | 
|  | 33 | +      env: | 
|  | 34 | +        KUBEBUILDER_ASSETS: ${{ env.KUBEBUILDER_DIR }}/bin | 
|  | 35 | +    - name: hub login | 
|  | 36 | +      if: (github.event_name == 'push' && endsWith(github.ref,'/master')) || (github.event_name == 'create' && startsWith(github.ref,'refs/tags/')) | 
|  | 37 | +      run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | 
|  | 38 | +    - name: deploy-tag   # when merged into master, tag master and push - ideally, this would be a separate job, but you cannot share docker build cache between jobs | 
|  | 39 | +      if: github.event_name == 'push' && endsWith(github.ref,'/master') | 
|  | 40 | +      run: make cd CONFIRM=true | 
|  | 41 | +    - name: deploy-master   # when merged into master, tag master and push - ideally, this would be a separate job, but you cannot share docker build cache between jobs | 
|  | 42 | +      if: github.event_name == 'push' && endsWith(github.ref,'/master') | 
|  | 43 | +      run: make cd CONFIRM=true BRANCH_NAME=master | 
|  | 44 | +    - name: release  # when based on a tag, tag master and push - ideally, this would be a separate job, but you cannot share docker build cache between jobs | 
|  | 45 | +      if: github.event_name == 'create' && startsWith(github.ref,'refs/tags/') | 
|  | 46 | +      run: make release CONFIRM=true | 
0 commit comments