github.com/giantswarm/apiextensions/v2@v2.6.2/.github/workflows/zz_generated.create_release_pr.yaml (about) 1 # DO NOT EDIT. Generated with: 2 # 3 # devctl gen workflows 4 # 5 name: Create Release PR 6 on: 7 push: 8 branches: 9 - 'master#release#v*.*.*' 10 - 'legacy#release#v*.*.*' 11 - 'release-v*.*.x#release#v*.*.*' 12 # "!" negates previous positive patterns so it has to be at the end. 13 - '!release-v*.x.x#release#v*.*.*' 14 jobs: 15 debug_info: 16 name: Debug info 17 runs-on: ubuntu-18.04 18 steps: 19 - name: Print github context JSON 20 run: | 21 cat <<EOF 22 ${{ toJson(github) }} 23 EOF 24 gather_facts: 25 name: Gather facts 26 runs-on: ubuntu-18.04 27 outputs: 28 unchanged: ${{ steps.get_unchanged.outputs.unchanged }} 29 base: ${{ steps.get_base.outputs.base }} 30 version: ${{ steps.get_version.outputs.version }} 31 steps: 32 - name: Get base 33 id: get_base 34 run: | 35 base="$(echo ${{ github.event.ref }} | cut -d '#' -f 1)" 36 echo "base=\"$base\"" 37 echo "::set-output name=base::${base}" 38 - name: Get version 39 id: get_version 40 run: | 41 version="$(echo ${{ github.event.ref }} | cut -d '#' -f 3)" 42 version="${version#v}" # Strip "v" prefix. 43 echo "version=\"$version\"" 44 echo "::set-output name=version::${version}" 45 - name: Checkout base code 46 uses: actions/checkout@v2 47 with: 48 ref: ${{ steps.get_base.outputs.base }} 49 - name: Get unchanged 50 id: get_unchanged 51 env: 52 sha: ${{ github.sha }} 53 run: | 54 base_head=$(git rev-parse HEAD) 55 echo "base_head=\"$base_head\"" 56 unchanged="false" 57 if [[ "$base_head" == "${{ env.sha }}" ]] ; then 58 unchanged="true" 59 fi 60 echo "unchanged=\"$unchanged\"" 61 echo "::set-output name=unchanged::${unchanged}" 62 install_architect: 63 name: Install architect 64 runs-on: ubuntu-18.04 65 env: 66 BINARY: "architect" 67 DIR: "/opt/cache" 68 IMAGE: "quay.io/giantswarm/architect" 69 IMAGE_PATH: "/usr/bin/architect" 70 VERSION: "1.2.0" 71 outputs: 72 cache_key: "${{ steps.get_cache_key.outputs.cache_key }}" 73 steps: 74 - name: Get cache key 75 id: get_cache_key 76 run: | 77 cache_key="install-${{ env.BINARY }}-${{ env.VERSION }}" 78 echo "::set-output name=cache_key::${cache_key}" 79 - name: Cache 80 id: cache 81 uses: actions/cache@v1 82 with: 83 key: "${{ steps.get_cache_key.outputs.cache_key }}" 84 path: "${{ env.DIR }}" 85 - name: Download 86 if: ${{ steps.cache.outputs.cache-hit != 'true' }} 87 run: | 88 mkdir -p ${{ env.DIR }} 89 docker container create --name tmp ${{ env.IMAGE }}:${{ env.VERSION }} 90 docker cp tmp:${{ env.IMAGE_PATH }} ${{ env.DIR }}/${{ env.BINARY }} 91 docker container rm tmp 92 - name: Smoke test 93 run: | 94 ${{ env.DIR }}/${{ env.BINARY }} version 95 - name: Upload artifact 96 uses: actions/upload-artifact@v1 97 with: 98 name: "${{ env.BINARY }}" 99 path: "${{ env.DIR }}/${{ env.BINARY }}" 100 install_hub: 101 name: Install hub 102 runs-on: ubuntu-18.04 103 env: 104 BINARY: "hub" 105 DIR: "/opt/cache" 106 VERSION: "2.14.2" 107 URL: "https://github.com/github/hub/releases/download/v2.14.2/hub-linux-amd64-2.14.2.tgz" 108 outputs: 109 cache_key: ${{ steps.get_cache_key.outputs.cache_key }} 110 steps: 111 - name: Get cache key 112 id: get_cache_key 113 run: | 114 cache_key="install-${{ env.BINARY }}-${{ env.VERSION }}" 115 echo "::set-output name=cache_key::${cache_key}" 116 - name: Cache 117 id: cache 118 uses: actions/cache@v1 119 with: 120 key: "${{ steps.get_cache_key.outputs.cache_key }}" 121 path: "${{ env.DIR }}" 122 - name: Download 123 if: ${{ steps.cache.outputs.cache-hit != 'true' }} 124 run: | 125 mkdir ${{ env.DIR }} 126 curl -fsSLo - ${{ env.URL }} | tar xvz --strip-components=1 --wildcards '*/bin/${{ env.BINARY }}' 127 mv bin/${{ env.BINARY }} ${{ env.DIR }} 128 chmod +x ${{ env.DIR }}/${{ env.BINARY }} 129 - name: Smoke test 130 run: | 131 ${{ env.DIR }}/${{ env.BINARY }} version 132 - name: Upload artifact 133 uses: actions/upload-artifact@v1 134 with: 135 name: "${{ env.BINARY }}" 136 path: "${{ env.DIR }}/${{ env.BINARY }}" 137 create_release_pr: 138 name: Create release PR 139 runs-on: ubuntu-18.04 140 if: ${{ needs.gather_facts.outputs.unchanged == 'true' }} 141 needs: 142 - gather_facts 143 - install_architect 144 - install_hub 145 env: 146 architect_flags: "--organisation ${{ github.repository_owner }} --project ${{ github.event.repository.name }}" 147 steps: 148 - name: Cache 149 id: cache 150 uses: actions/cache@v1 151 with: 152 key: "${{ needs.install_architect.outputs.cache_key }}+++${{ needs.install_hub.outputs.cache_key }}" 153 path: /opt/bin 154 - name: Download architect artifact to /opt/bin 155 if: ${{ steps.cache.outputs.cache-hit != 'true' }} 156 uses: actions/download-artifact@v2 157 with: 158 name: architect 159 path: /opt/bin 160 - name: Download hub artifact to /opt/bin 161 if: ${{ steps.cache.outputs.cache-hit != 'true' }} 162 uses: actions/download-artifact@v2 163 with: 164 name: hub 165 path: /opt/bin 166 - name: Prepare /opt/bin 167 run: | 168 chmod +x /opt/bin/* 169 echo "::add-path::/opt/bin" 170 - name: Print architect version 171 run: | 172 architect version ${{ env.architect_flags }} 173 - name: Checkout code 174 uses: actions/checkout@v2 175 - name: Prepare release changes 176 run: | 177 architect prepare-release ${{ env.architect_flags }} --version "${{ needs.gather_facts.outputs.version }}" 178 - name: Create release commit 179 env: 180 version: "${{ needs.gather_facts.outputs.version }}" 181 run: | 182 git config --local user.email "action@github.com" 183 git config --local user.name "github-actions" 184 git add -A 185 git commit -m "release v${{ env.version }}" 186 - name: Push changes 187 env: 188 remote_repo: "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" 189 run: | 190 git push "${remote_repo}" HEAD:${{ github.ref }} 191 - name: Create PR 192 env: 193 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 194 base: "${{ needs.gather_facts.outputs.base }}" 195 version: "${{ needs.gather_facts.outputs.version }}" 196 run: | 197 hub pull-request -f -m "release v${{ env.version }}" -a ${{ github.actor }} -b ${{ env.base }} -h ${{ github.event.ref }}