prerelease.yaml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. on:
  2. push:
  3. tags:
  4. - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
  5. name: Create prerelease w/ binaries and docker image
  6. jobs:
  7. build-push-porter:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Get tag name
  11. id: tag_name
  12. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  13. env:
  14. GITHUB_TAG: ${{ github.ref }}
  15. - name: Checkout
  16. uses: actions/checkout@v3
  17. - name: Setup docker
  18. uses: docker/login-action@v1
  19. with:
  20. username: ${{ secrets.DOCKERHUB_USERNAME }}
  21. password: ${{ secrets.DOCKERHUB_TOKEN }}
  22. - name: Write Dashboard Environment Variables
  23. run: |
  24. cat >./dashboard/.env <<EOL
  25. NODE_ENV=production
  26. APPLICATION_CHART_REPO_URL=https://charts.getporter.dev
  27. ADDON_CHART_REPO_URL=https://chart-addons.getporter.dev
  28. EOL
  29. cat ./dashboard/.env
  30. - name: Build
  31. run: |
  32. DOCKER_BUILDKIT=1 docker build . -t porter1/porter:${{steps.tag_name.outputs.tag}} -f ./ee/docker/ee.Dockerfile --build-arg version=${{steps.tag_name.outputs.tag}}
  33. - name: Push
  34. run: |
  35. docker push porter1/porter:${{steps.tag_name.outputs.tag}}
  36. - name: Configure AWS credentials
  37. uses: aws-actions/configure-aws-credentials@v1
  38. with:
  39. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  40. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  41. aws-region: us-east-2
  42. - name: Login to ECR public
  43. id: login-ecr
  44. run: |
  45. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  46. - name: Push to ECR public
  47. run: |
  48. docker tag porter1/porter:${{steps.tag_name.outputs.tag}} public.ecr.aws/o1j4x7p4/porter:${{steps.tag_name.outputs.tag}}
  49. docker push public.ecr.aws/o1j4x7p4/porter:${{steps.tag_name.outputs.tag}}
  50. build-push-provisioner:
  51. runs-on: ubuntu-latest
  52. steps:
  53. - name: Get tag name
  54. id: tag_name
  55. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  56. env:
  57. GITHUB_TAG: ${{ github.ref }}
  58. - name: Checkout
  59. uses: actions/checkout@v3
  60. - name: Configure AWS credentials
  61. uses: aws-actions/configure-aws-credentials@v1
  62. with:
  63. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  64. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  65. aws-region: us-east-2
  66. - name: Login to ECR public
  67. id: login-ecr
  68. run: |
  69. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  70. - name: Build
  71. run: |
  72. DOCKER_BUILDKIT=1 docker build . -t public.ecr.aws/o1j4x7p4/provisioner-service:${{steps.tag_name.outputs.tag}} -f ./ee/docker/provisioner.Dockerfile
  73. - name: Push to ECR public
  74. run: |
  75. docker push public.ecr.aws/o1j4x7p4/provisioner-service:${{steps.tag_name.outputs.tag}}
  76. build-push-worker-pool:
  77. runs-on: ubuntu-latest
  78. steps:
  79. - name: Get tag name
  80. id: tag_name
  81. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  82. env:
  83. GITHUB_TAG: ${{ github.ref }}
  84. - name: Checkout
  85. uses: actions/checkout@v3
  86. - name: Configure AWS credentials
  87. uses: aws-actions/configure-aws-credentials@v1
  88. with:
  89. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  90. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  91. aws-region: us-east-2
  92. - name: Login to ECR public
  93. id: login-ecr
  94. run: |
  95. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  96. - name: Build
  97. run: |
  98. DOCKER_BUILDKIT=1 docker build . -t public.ecr.aws/o1j4x7p4/worker-pool:${{steps.tag_name.outputs.tag}} -f ./workers/Dockerfile
  99. - name: Push to ECR public
  100. run: |
  101. docker push public.ecr.aws/o1j4x7p4/worker-pool:${{steps.tag_name.outputs.tag}}
  102. build-linux:
  103. name: Build Linux binaries
  104. runs-on: ubuntu-latest
  105. steps:
  106. - name: Get tag name
  107. id: tag_name
  108. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  109. env:
  110. GITHUB_TAG: ${{ github.ref }}
  111. - name: Checkout code
  112. uses: actions/checkout@v2
  113. - name: Set up Go
  114. uses: actions/setup-go@v2
  115. with:
  116. go-version: 1.18
  117. - name: Write Dashboard Environment Variables
  118. run: |
  119. cat >./dashboard/.env <<EOL
  120. NODE_ENV=production
  121. APPLICATION_CHART_REPO_URL=https://charts.getporter.dev
  122. ADDON_CHART_REPO_URL=https://chart-addons.getporter.dev
  123. EOL
  124. - name: Build and zip static folder
  125. run: |
  126. mkdir -p ./release/static
  127. cd dashboard
  128. npm i --production=false --legacy-peer-deps
  129. npm run build
  130. cd ..
  131. zip --junk-paths ./release/static/static_${{steps.tag_name.outputs.tag}}.zip ./dashboard/build/*
  132. env:
  133. NODE_ENV: production
  134. - name: Build Linux binaries
  135. run: |
  136. go build -ldflags="-w -s -X 'github.com/porter-dev/porter/cli/cmd/config.Version=${{steps.tag_name.outputs.tag}}' -X 'github.com/porter-dev/porter/cli/cmd/errors.SentryDSN=${{secrets.SENTRY_DSN}}'" -a -tags cli -o ./porter ./cli &
  137. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -o ./docker-credential-porter ./cmd/docker-credential-porter/ &
  138. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -tags ee -o ./portersvr ./cmd/app/ &
  139. wait
  140. env:
  141. GOOS: linux
  142. GOARCH: amd64
  143. CGO_ENABLED: 0
  144. # Note: we have to zip all binaries before uploading them as artifacts --
  145. # without this step, the binaries will be uploaded but the file metadata will
  146. # be listed as plaintext after downloading the artifact in a later step
  147. #
  148. # TODO: investigate
  149. - name: Zip Linux binaries
  150. run: |
  151. mkdir -p ./release/linux
  152. zip --junk-paths ./release/linux/porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip ./porter
  153. zip --junk-paths ./release/linux/portersvr_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip ./portersvr
  154. zip --junk-paths ./release/linux/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip ./docker-credential-porter
  155. - name: Upload binaries
  156. uses: actions/upload-artifact@v2
  157. with:
  158. path: ./release/linux
  159. name: linux-binaries
  160. retention-days: 1
  161. - name: Upload static binaries
  162. uses: actions/upload-artifact@v2
  163. with:
  164. path: ./release/static
  165. name: static-binaries
  166. retention-days: 1
  167. build-mac:
  168. name: Build MacOS binaries
  169. runs-on: macos-11
  170. steps:
  171. - name: Get tag name
  172. id: tag_name
  173. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  174. env:
  175. GITHUB_TAG: ${{ github.ref }}
  176. - name: Checkout code
  177. uses: actions/checkout@v2
  178. - name: Set up Go
  179. uses: actions/setup-go@v2
  180. with:
  181. go-version: 1.18
  182. - name: Write Dashboard Environment Variables
  183. run: |
  184. cat >./dashboard/.env <<EOL
  185. NODE_ENV=production
  186. APPLICATION_CHART_REPO_URL=https://charts.getporter.dev
  187. ADDON_CHART_REPO_URL=https://chart-addons.getporter.dev
  188. EOL
  189. - name: Build and Zip MacOS amd64 binaries
  190. run: |
  191. go build -ldflags="-w -s -X 'github.com/porter-dev/porter/cli/cmd/config.Version=${{steps.tag_name.outputs.tag}}' -X 'github.com/porter-dev/porter/cli/cmd/errors.SentryDSN=${{secrets.SENTRY_DSN}}'" -a -tags cli -o ./amd64/porter ./cli &
  192. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -o ./amd64/docker-credential-porter ./cmd/docker-credential-porter/ &
  193. go build -ldflags="-w -s -X 'main.Version=${{steps.tag_name.outputs.tag}}'" -a -tags ee -o ./amd64/portersvr ./cmd/app/ &
  194. wait
  195. mkdir -p ./release/darwin
  196. zip --junk-paths ./release/darwin/UNSIGNED_porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip ./amd64/porter
  197. zip --junk-paths ./release/darwin/UNSIGNED_portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip ./amd64/portersvr
  198. zip --junk-paths ./release/darwin/UNSIGNED_docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip ./amd64/docker-credential-porter
  199. env:
  200. GOOS: darwin
  201. GOARCH: amd64
  202. CGO_ENABLED: 0
  203. - name: Upload binaries
  204. uses: actions/upload-artifact@v2
  205. with:
  206. path: ./release/darwin
  207. name: mac-binaries
  208. retention-days: 1
  209. notarize:
  210. name: Notarize Darwin binaries
  211. runs-on: macos-11
  212. needs: build-mac
  213. steps:
  214. - name: Get tag name
  215. id: tag_name
  216. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  217. env:
  218. GITHUB_TAG: ${{ github.ref }}
  219. - name: Download binaries
  220. uses: actions/download-artifact@v2
  221. with:
  222. name: mac-binaries
  223. path: release/
  224. - name: Unzip Darwin binaries
  225. run: |
  226. unzip ./release/UNSIGNED_porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  227. unzip ./release/UNSIGNED_portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  228. unzip ./release/UNSIGNED_docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  229. - name: Import Code-Signing Certificates
  230. uses: Apple-Actions/import-codesign-certs@v1
  231. with:
  232. # The certificates in a PKCS12 file encoded as a base64 string
  233. p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
  234. # The password used to import the PKCS12 file.
  235. p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
  236. - name: Install gon via HomeBrew for code signing and app notarization
  237. run: |
  238. brew tap porter-dev/gon
  239. brew install porter-dev/gon/gon
  240. - name: Create a porter.gon.json file
  241. run: |
  242. echo "
  243. {
  244. \"source\": [\"./porter\"],
  245. \"bundle_id\": \"cli.porter\",
  246. \"apple_id\": {
  247. \"password\": \"@env:AC_PASSWORD\"
  248. },
  249. \"sign\": {
  250. \"application_identity\": \"${{ secrets.AC_APPLICATION_IDENTITY }}\"
  251. },
  252. \"zip\": {
  253. \"output_path\": \"./release/porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip\"
  254. }
  255. }
  256. " > ./porter.gon.json
  257. - name: Create a portersvr.gon.json file
  258. run: |
  259. echo "
  260. {
  261. \"source\": [\"./portersvr\"],
  262. \"bundle_id\": \"cli.portersvr\",
  263. \"apple_id\": {
  264. \"password\": \"@env:AC_PASSWORD\"
  265. },
  266. \"sign\": {
  267. \"application_identity\": \"${{ secrets.AC_APPLICATION_IDENTITY }}\"
  268. },
  269. \"zip\": {
  270. \"output_path\": \"./release/portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip\"
  271. }
  272. }
  273. " > ./portersvr.gon.json
  274. - name: Create a docker-credential-porter.gon.json file
  275. run: |
  276. echo "
  277. {
  278. \"source\": [\"./docker-credential-porter\"],
  279. \"bundle_id\": \"cli.docker-credential-porter\",
  280. \"apple_id\": {
  281. \"password\": \"@env:AC_PASSWORD\"
  282. },
  283. \"sign\": {
  284. \"application_identity\": \"${{ secrets.AC_APPLICATION_IDENTITY }}\"
  285. },
  286. \"zip\": {
  287. \"output_path\": \"./release/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip\"
  288. }
  289. }
  290. " > ./docker-credential-porter.gon.json
  291. - name: Sign the mac binaries with Gon
  292. env:
  293. AC_USERNAME: ${{ secrets.AC_USERNAME }}
  294. AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
  295. run: |
  296. gon ./porter.gon.json &
  297. gon ./portersvr.gon.json &
  298. gon ./docker-credential-porter.gon.json &
  299. wait
  300. - name: Upload binaries
  301. uses: actions/upload-artifact@v2
  302. with:
  303. path: ./release
  304. name: mac-binaries
  305. retention-days: 1
  306. release:
  307. name: Zip binaries, create release and upload assets
  308. runs-on: ubuntu-latest
  309. needs:
  310. - notarize
  311. - build-linux
  312. steps:
  313. - name: Get tag name
  314. id: tag_name
  315. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  316. env:
  317. GITHUB_TAG: ${{ github.ref }}
  318. - name: Download binaries
  319. uses: actions/download-artifact@v2
  320. with:
  321. name: linux-binaries
  322. path: release/linux
  323. - name: Download binaries
  324. uses: actions/download-artifact@v2
  325. with:
  326. name: static-binaries
  327. path: release/static
  328. - name: Download binaries
  329. uses: actions/download-artifact@v2
  330. with:
  331. name: mac-binaries
  332. path: release/darwin
  333. - name: Create Release
  334. id: create_release
  335. uses: actions/create-release@v1
  336. env:
  337. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  338. with:
  339. tag_name: ${{ github.ref }}
  340. release_name: Release ${{ github.ref }}
  341. draft: false
  342. prerelease: true
  343. - name: Upload Linux CLI Release Asset
  344. id: upload-linux-cli-release-asset
  345. uses: actions/upload-release-asset@v1
  346. env:
  347. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  348. GITHUB_TAG: ${{ github.ref }}
  349. with:
  350. upload_url: ${{ steps.create_release.outputs.upload_url }}
  351. asset_path: ./release/linux/porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  352. asset_name: porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  353. asset_content_type: application/zip
  354. - name: Upload Linux Server Release Asset
  355. id: upload-linux-server-release-asset
  356. uses: actions/upload-release-asset@v1
  357. env:
  358. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  359. GITHUB_TAG: ${{ github.ref }}
  360. with:
  361. upload_url: ${{ steps.create_release.outputs.upload_url }}
  362. asset_path: ./release/linux/portersvr_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  363. asset_name: portersvr_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  364. asset_content_type: application/zip
  365. - name: Upload Linux Docker Credential Release Asset
  366. id: upload-linux-docker-cred-release-asset
  367. uses: actions/upload-release-asset@v1
  368. env:
  369. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  370. GITHUB_TAG: ${{ github.ref }}
  371. with:
  372. upload_url: ${{ steps.create_release.outputs.upload_url }}
  373. asset_path: ./release/linux/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  374. asset_name: docker-credential-porter_${{steps.tag_name.outputs.tag}}_Linux_x86_64.zip
  375. asset_content_type: application/zip
  376. - name: Upload Darwin CLI Release Asset
  377. id: upload-darwin-cli-release-asset
  378. uses: actions/upload-release-asset@v1
  379. env:
  380. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  381. GITHUB_TAG: ${{ github.ref }}
  382. with:
  383. upload_url: ${{ steps.create_release.outputs.upload_url }}
  384. asset_path: ./release/darwin/porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  385. asset_name: porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  386. asset_content_type: application/zip
  387. - name: Upload Darwin Server Release Asset
  388. id: upload-darwin-server-release-asset
  389. uses: actions/upload-release-asset@v1
  390. env:
  391. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  392. GITHUB_TAG: ${{ github.ref }}
  393. with:
  394. upload_url: ${{ steps.create_release.outputs.upload_url }}
  395. asset_path: ./release/darwin/portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  396. asset_name: portersvr_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  397. asset_content_type: application/zip
  398. - name: Upload Darwin Docker Credential Release Asset
  399. id: upload-darwin-docker-cred-release-asset
  400. uses: actions/upload-release-asset@v1
  401. env:
  402. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  403. GITHUB_TAG: ${{ github.ref }}
  404. with:
  405. upload_url: ${{ steps.create_release.outputs.upload_url }}
  406. asset_path: ./release/darwin/docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  407. asset_name: docker-credential-porter_${{steps.tag_name.outputs.tag}}_Darwin_x86_64.zip
  408. asset_content_type: application/zip
  409. - name: Upload Static Release Asset
  410. id: upload-static-release-asset
  411. uses: actions/upload-release-asset@v1
  412. env:
  413. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  414. GITHUB_TAG: ${{ github.ref }}
  415. with:
  416. upload_url: ${{ steps.create_release.outputs.upload_url }}
  417. asset_path: ./release/static/static_${{steps.tag_name.outputs.tag}}.zip
  418. asset_name: static_${{steps.tag_name.outputs.tag}}.zip
  419. asset_content_type: application/zip
  420. build-push-docker-cli:
  421. name: Build a new porter-cli docker image
  422. runs-on: ubuntu-latest
  423. needs: release
  424. steps:
  425. - name: Get tag name
  426. id: tag_name
  427. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  428. env:
  429. GITHUB_TAG: ${{ github.ref }}
  430. - name: Checkout
  431. uses: actions/checkout@v3
  432. - name: Configure AWS credentials
  433. uses: aws-actions/configure-aws-credentials@v1
  434. with:
  435. aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
  436. aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
  437. aws-region: us-east-2
  438. - name: Login to ECR public
  439. id: login-ecr
  440. run: |
  441. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/o1j4x7p4
  442. - name: Login to GHCR
  443. id: login-ghcr
  444. run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
  445. - name: Build
  446. run: |
  447. docker build ./services/porter_cli_container \
  448. -t public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}} \
  449. -f ./services/porter_cli_container/Dockerfile \
  450. --build-arg VERSION=${{steps.tag_name.outputs.tag}} \
  451. --build-arg SENTRY_DSN=${{secrets.SENTRY_DSN}}
  452. - name: Push to ECR public
  453. run: docker push public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}}
  454. - name: Push to GHCR
  455. run: |
  456. docker tag public.ecr.aws/o1j4x7p4/porter-cli:${{steps.tag_name.outputs.tag}} ghcr.io/porter-dev/porter/porter-cli:${{steps.tag_name.outputs.tag}}
  457. docker push ghcr.io/porter-dev/porter/porter-cli:${{steps.tag_name.outputs.tag}}
  458. update-porter-update-action:
  459. name: Update porter-update-action
  460. runs-on: ubuntu-latest
  461. needs: build-push-docker-cli
  462. steps:
  463. - name: Get tag name
  464. id: tag_name
  465. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  466. env:
  467. GITHUB_TAG: ${{ github.ref }}
  468. - name: Push new branch with updated CLI
  469. run: |
  470. cd $GITHUB_WORKSPACE
  471. git clone https://portersupport:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/porter-update-action
  472. cd porter-update-action
  473. git checkout -B "${{steps.tag_name.outputs.tag}}"
  474. cat >Dockerfile <<EOL
  475. FROM ghcr.io/porter-dev/porter/porter-cli:${{steps.tag_name.outputs.tag}}
  476. LABEL org.opencontainers.image.source="https://github.com/porter-dev/porter"
  477. COPY entrypoint.sh /action/
  478. ENTRYPOINT ["/action/entrypoint.sh"]
  479. EOL
  480. git config user.name "Update Bot"
  481. git config user.email "support@porter.run"
  482. git add .
  483. git commit -m "Update to CLI version ${{steps.tag_name.outputs.tag}}"
  484. git push --set-upstream origin ${{steps.tag_name.outputs.tag}} -f
  485. update-porter-cli-action:
  486. name: Update porter-cli-action
  487. runs-on: ubuntu-latest
  488. needs: build-push-docker-cli
  489. steps:
  490. - name: Get tag name
  491. id: tag_name
  492. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  493. env:
  494. GITHUB_TAG: ${{ github.ref }}
  495. - name: Push new branch with updated CLI
  496. run: |
  497. cd $GITHUB_WORKSPACE
  498. git clone https://portersupport:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/porter-cli-action
  499. cd porter-cli-action
  500. git checkout -B "${{steps.tag_name.outputs.tag}}"
  501. cat >Dockerfile <<EOL
  502. FROM ghcr.io/porter-dev/porter/porter-cli:${{steps.tag_name.outputs.tag}}
  503. LABEL org.opencontainers.image.source="https://github.com/porter-dev/porter"
  504. COPY entrypoint.sh /action/
  505. ENTRYPOINT ["/action/entrypoint.sh"]
  506. EOL
  507. git config user.name "Update Bot"
  508. git config user.email "support@porter.run"
  509. git add .
  510. git commit -m "Update to CLI version ${{steps.tag_name.outputs.tag}}"
  511. git push --set-upstream origin ${{steps.tag_name.outputs.tag}} -f
  512. update-new-release-tests:
  513. name: Update new-release-tests
  514. runs-on: ubuntu-latest
  515. needs: [update-porter-update-action, update-porter-cli-action]
  516. steps:
  517. - name: Get tag name
  518. id: tag_name
  519. run: echo "tag=${GITHUB_TAG/refs\/tags\//}" >> $GITHUB_OUTPUT
  520. env:
  521. GITHUB_TAG: ${{ github.ref }}
  522. - name: Update new-release-tests
  523. run: |
  524. cd $GITHUB_WORKSPACE
  525. git clone https://portersupport:${{ secrets.PORTER_DEV_GITHUB_TOKEN }}@github.com/porter-dev/new-release-tests
  526. cd new-release-tests/.github/workflows
  527. sed -i 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_pack_production.yml
  528. sed -i 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_pack_production.yml
  529. sed -i 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_docker_production.yml
  530. sed -i 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' porter_test_docker_production.yml
  531. sed -i 's/uses: porter-dev\/porter-update-action.*/uses: porter-dev\/porter-update-action@${{ steps.tag_name.outputs.tag }}/g' test_porter_cli.yml
  532. sed -i 's/uses: porter-dev\/porter-cli-action.*/uses: porter-dev\/porter-cli-action@${{ steps.tag_name.outputs.tag }}/g' test_porter_cli.yml
  533. cd ../..
  534. git config user.name "Update Bot"
  535. git config user.email "support@porter.run"
  536. git diff --quiet --exit-code || git add . && git commit -m "Update to Porter GHA version ${{steps.tag_name.outputs.tag}}" && git push -f
  537. git checkout test-preview-env
  538. git merge main -m "Merge with main"
  539. sed -i 's/TEST:v.*/TEST:${{ steps.tag_name.outputs.tag }}/g' porter.yaml
  540. git diff --quiet --exit-code || git add . && git commit -m "Update to Porter GHA version ${{steps.tag_name.outputs.tag}}" && git push -f
  541. run-new-release-tests-workflows:
  542. name: Run new-release-tests Porter workflows
  543. runs-on: ubuntu-latest
  544. needs: update-new-release-tests
  545. steps:
  546. - name: Run porter_test_pack_production.yml workflow
  547. run: gh workflow run porter_test_pack_production.yml --repo porter-dev/new-release-tests
  548. env:
  549. GITHUB_TOKEN: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}
  550. - name: Run porter_test_docker_production.yml workflow
  551. run: gh workflow run porter_test_docker_production.yml --repo porter-dev/new-release-tests
  552. env:
  553. GITHUB_TOKEN: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}
  554. - name: Run test_porter_cli.yml workflow
  555. run: gh workflow run test_porter_cli.yml --repo porter-dev/new-release-tests
  556. env:
  557. GITHUB_TOKEN: ${{ secrets.PORTER_DEV_GITHUB_TOKEN }}