Skip to content

ci: add stable promotion workflow and dev deployment #6

ci: add stable promotion workflow and dev deployment

ci: add stable promotion workflow and dev deployment #6

Workflow file for this run

name: Release
on:
push:
branches: [ main ]
jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.check-version.outputs.version }}
permissions:
issues: write
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for semantic-release
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install semantic-release
run: |
npm install -g @semantic-release/[email protected] \
@semantic-release/[email protected] \
@semantic-release/[email protected] \
@semantic-release/[email protected] \
[email protected] \
[email protected]
- name: Release
id: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
- name: Check version
id: check-version
run: >
if [ -f VERSION ]; then
VERSION=$(cat VERSION)
echo "Resolved version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "No version produced."
echo "version=" >> $GITHUB_OUTPUT
fi
publish:
runs-on: ubuntu-latest
needs: release
if: needs.release.outputs.version != '' # Skip deploy if no version is set
permissions:
id-token: write
env:
ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.GH_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and Push Image
uses: docker/build-push-action@v4
with:
push: true
tags: |
${{ env.ECR_REGISTRY }}/pillarbox-event-dispatcher:${{ needs.release.outputs.version }}
${{ env.ECR_REGISTRY }}/pillarbox-event-dispatcher:latest
deploy-dev:
runs-on: ubuntu-latest
needs: publish
permissions:
id-token: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.GH_DEV_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: ECS deployment
run: >
aws ecs update-service \
--cluster pillarbox-monitoring-cluster \
--service dispatch-service \
--force-new-deployment \
--region ${{ secrets.AWS_REGION }} >/dev/null