prerelease.yaml 24 KB

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