Skip to content

Commit

Permalink
ci: use Docker Hub and fix spacectl deploy section (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehassett authored Oct 3, 2024
1 parent 44a4597 commit c642690
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit c642690

Please sign in to comment.