Skip to content

Temporarily check for production deployments #96

Temporarily check for production deployments

Temporarily check for production deployments #96

Workflow file for this run

name: Deployments
on:
push:
branches:
- main
env:
CI: true
permissions: write-all
jobs:
create-release-pr:
name: Create release pr
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --tags origin
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Create release pr / create tags
id: changesets
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: bun run version-packages
publish: bun run publish-packages
- name: Echo outputs
run: |
echo "hasChangesets=${{ steps.changesets.outputs.hasChangesets }}"
echo "publishedPackages=${{ steps.changesets.outputs.publishedPackages }}"
echo "publishedPackageNames=${{ toJSON(fromJSON(steps.changesets.outputs.publishedPackages).*['name']) }}"
outputs:
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
publishedPackageNames: ${{ toJSON(fromJSON(steps.changesets.outputs.publishedPackages).*['name']) }}
publish-frontend:
needs: create-release-pr
name: Publish frontend
runs-on: ubuntu-latest
# if: |
# needs.create-release-pr.outputs.hasChangesets == 'false' && (
# contains(needs.create-release-pr.outputs.publishedPackageNames, '@haishin/tsconfig') == true ||
# contains(needs.create-release-pr.outputs.publishedPackageNames, '@haishin/utils') == true ||
# contains(needs.create-release-pr.outputs.publishedPackageNames, '@haishin/frontend') == true
# )
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Install Railway
run: bun install --global @railway/cli
- name: Deploy
run: railway up -s "frontend"
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
publish-backend:
needs: create-release-pr
name: Publish backend
runs-on: ubuntu-latest
# if: |
# needs.create-release-pr.outputs.hasChangesets == 'false' && (
# contains(needs.create-release-pr.outputs.publishedPackageNames, '@haishin/tsconfig') == true ||
# contains(needs.create-release-pr.outputs.publishedPackageNames, '@haishin/utils') == true ||
# contains(needs.create-release-pr.outputs.publishedPackageNames, '@haishin/backend') == true
# )
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Install Railway
run: bun install --global @railway/cli
- name: Deploy
run: railway up -s "backend"
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
cleanup-old-release-tags:
needs: create-release-pr
name: Cleanup old release tags
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: write
if: |
needs.create-release-pr.outputs.hasChangesets == 'false' && needs.create-release-pr.outputs.publishedPackages != '[]'
strategy:
matrix:
package: ${{ fromJSON(needs.create-release-pr.outputs.publishedPackages).*['name'] }}
steps:
- name: 'Delete release tags'
uses: jay2610/[email protected]
with:
keep_latest: 1
delete_tags: true
delete_tag_pattern: ${{ matrix.package }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}