Skip to content

feat: #1 initial github action #1

feat: #1 initial github action

feat: #1 initial github action #1

on:
push:
branches:
- main
permissions:
contents: write
packages: write
pull-requests: write
id-token: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: php
- run: echo "release_created=${{ steps.release.outputs.release_created }}" >> "$GITHUB_OUTPUT"
- run: echo "tag_name=${{ steps.release.outputs.tag_name }}" >> "$GITHUB_OUTPUT"
build-and-publish:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
steps:
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ghcr.io/ptah-sh/ptah-server:latest,ghcr.io/ptah-sh/ptah-server:${{ needs.release-please.outputs.tag_name }}
# TODO: should we create a github deployment?
deploy:
runs-on: ubuntu-latest
needs:
- release-please
- build-and-publish
if: ${{ needs.release-please.outputs.release_created }}
steps:
- name: Deploy
run: |
curl --fail-with-body -X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer ${{ secrets.PTAH_API_TOKEN }}' \
-d '{"processes":[{"name":"svc","dockerImage":"ghcr.io/ptah-sh/ptah-server:${{ needs.release-please.outputs.tag_name }}"}]}' \
https://ctl.ptah.sh/api/v0/services/3/deploy