|
| 1 | +on: |
| 2 | + push: |
| 3 | + tags: |
| 4 | + - 'v*' |
| 5 | + |
| 6 | +name: Upload Release Asset |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Upload Release Asset |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v2 |
| 15 | + |
| 16 | + - name: kubebuilder-env |
| 17 | + run: echo "::set-env name=KUBEBUILDER_DIR::/tmp/kubebuilder_install" |
| 18 | + - name: kubebuilder |
| 19 | + run: make kubebuilder KUBEBUILDER_DIR=${KUBEBUILDER_DIR} # we use this dir because /usr/local/kubebuilder is protected |
| 20 | + - name: manifest |
| 21 | + run: make manifest KUBEBUILDER_DIR=${KUBEBUILDER_DIR} # we use this dir because /usr/local/kubebuilder is protected |
| 22 | + - name: Get the version |
| 23 | + id: get_version |
| 24 | + run: echo ::set-env name=VERSION::${GITHUB_REF/refs\/tags\//} |
| 25 | + - name: Create Release |
| 26 | + id: create_release |
| 27 | + uses: actions/create-release@v1 |
| 28 | + env: |
| 29 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + with: |
| 31 | + tag_name: ${{ env.VERSION }} |
| 32 | + release_name: ${{ env.VERSION }} |
| 33 | + draft: false |
| 34 | + prerelease: false |
| 35 | + - name: Upload cluster-template |
| 36 | + uses: actions/upload-release-asset@v1 |
| 37 | + env: |
| 38 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + with: |
| 40 | + # This pulls from the CREATE RELEASE step above, referencing it's ID to get |
| 41 | + # its outputs object, which include a `upload_url`. See this blog post for |
| 42 | + # more info: |
| 43 | + # https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 44 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 45 | + asset_path: out/release/infrastructure-packet/${{ env.VERSION }}/cluster-template.yaml |
| 46 | + asset_name: cluster-template.yaml |
| 47 | + asset_content_type: application/yaml |
| 48 | + - name: Upload clusterctl |
| 49 | + uses: actions/upload-release-asset@v1 |
| 50 | + env: |
| 51 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + with: |
| 53 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 54 | + asset_path: out/release/infrastructure-packet/${{ env.VERSION }}/clusterctl.yaml |
| 55 | + asset_name: clusterctl.yaml |
| 56 | + asset_content_type: application/yaml |
| 57 | + - name: Upload infrastructure-components |
| 58 | + uses: actions/upload-release-asset@v1 |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + with: |
| 62 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 63 | + asset_path: out/release/infrastructure-packet/${{ env.VERSION }}/infrastructure-components.yaml |
| 64 | + asset_name: infrastructure-components.yaml |
| 65 | + asset_content_type: application/yaml |
| 66 | + - name: Upload infrastructure-components |
| 67 | + uses: actions/upload-release-asset@v1 |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + with: |
| 71 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 72 | + asset_path: out/release/infrastructure-packet/${{ env.VERSION }}/metadata.yaml |
| 73 | + asset_name: metadata.yaml |
| 74 | + asset_content_type: application/yaml |
0 commit comments