-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: use Docker Hub and fix spacectl deploy section (#17)
- Loading branch information
Showing
1 changed file
with
15 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,8 +52,8 @@ jobs: | |
needs: check_version | ||
if: ${{ (github.event.pull_request.merged == true) && (needs.check_version.outputs.package_version != needs.check_version.outputs.previous_version) }} | ||
env: | ||
REGISTRY: "ghcr.io" | ||
IMAGE_NAME: "ehassett/ethanhassett-com" | ||
DOCKERHUB_USERNAME: "hassett" | ||
IMAGE_NAME: "ethanhassett-com" | ||
VERSION: ${{ needs.check_version.outputs.package_version }} | ||
steps: | ||
- name: Checkout code | ||
|
@@ -64,18 +64,17 @@ jobs: | |
- name: Login to registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
username: ${{ env.DOCKERHUB_USERNAME}} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | ||
${{ env.DOCKERHUB_USERNAME}}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} | ||
${{ env.DOCKERHUB_USERNAME}}/${{ env.IMAGE_NAME }}:latest | ||
release: | ||
name: Release and Tag New Version | ||
|
@@ -121,13 +120,13 @@ jobs: | |
|
||
- name: Deploy Stack | ||
run: | | ||
unconfirmed=$(spacectl stack run list --id tofu-ethanhassett-com | grep -c UNCONFIRMED) | ||
if [[ $unconfirmed == 1 ]]; then | ||
spacectl stack confirm --id tofu-ethanhassett-com | ||
elif [[ $unconfirmed == 0 ]]; then | ||
echo "::error title=NO-UNCONFIRMED-RUNS::No unconfirmed Spacelift runs found" | ||
exit 1 | ||
elif [[ $unconfirmed -gt 1 ]]; then | ||
echo "::error title=MULTIPLE-UNCONFIRMED-RUNS::Multiple unconfirmed Spacelift runs found" | ||
exit 1 | ||
if [[ $(spacectl stack run list --id tofu-ethanhassett-com | grep -c UNCONFIRMED) -gt 0 ]]; then | ||
run_id=$(spacectl stack run list --id tofu-ethanhassett-com \ | ||
| grep -m 1 UNCONFIRMED \ | ||
| cut -d "|" -f 1 \ | ||
| tr -d " \t\n\r" \ | ||
| sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g") | ||
spacectl stack confirm --id tofu-ethanhassett-com --run "$run_id" | ||
else | ||
echo "No runs need confirmation!" | ||
fi |