Refactor TagInput and Settings components for improved UI and functio… #8
Workflow file for this run
This file contains hidden or 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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Image tag (e.g. v0.1.0). Defaults to git ref." | |
| required: false | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE: ghcr.io/spacedriveapp/spacebot | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Determine version tag | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.tag }}" ]; then | |
| VERSION="${{ github.event.inputs.tag }}" | |
| elif [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| else | |
| VERSION="dev-$(echo $GITHUB_SHA | head -c 7)" | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Build and push slim | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: slim | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE }}:${{ steps.version.outputs.version }}-slim | |
| ${{ env.IMAGE }}:slim | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and push full | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: full | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE }}:${{ steps.version.outputs.version }}-full | |
| ${{ env.IMAGE }}:full | |
| ${{ env.IMAGE }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Log in to Fly registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: registry.fly.io | |
| username: x | |
| password: ${{ secrets.FLY_API_TOKEN }} | |
| - name: Push to Fly registry | |
| run: | | |
| docker buildx imagetools create \ | |
| --tag registry.fly.io/spacebot-image:${{ steps.version.outputs.version }} \ | |
| --tag registry.fly.io/spacebot-image:latest \ | |
| ${{ env.IMAGE }}:latest | |
| - name: Roll out to hosted instances | |
| if: success() | |
| run: | | |
| curl -sf -X POST https://api.spacebot.sh/api/admin/rollout \ | |
| -H "Content-Type: application/json" \ | |
| -H "X-Internal-Key: ${{ secrets.PLATFORM_INTERNAL_KEY }}" \ | |
| -d '{"image_tag": "${{ steps.version.outputs.version }}"}' | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.version }} | |
| generate_release_notes: true | |