chore: remove old workflows #5
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: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| TF_VAR_env: live | |
| TF_VAR_env_vars: ${{ secrets.LIVE_ENV_VARS }} | |
| TF_VAR_zone_id: ${{ secrets.LIVE_ZONE_ID }} | |
| TF_VAR_root_domain: lhowsam.com | |
| TF_VAR_sub_domain: nowplaying.lhowsam.com | |
| TF_VAR_private_key: ${{ secrets.LIVE_PRIVATE_KEY }} | |
| TF_VAR_certificate_body: ${{ secrets.LIVE_CERTIFICATE_BODY }} | |
| TF_VAR_certificate_chain: ${{ secrets.LIVE_CERTIFICATE_CHAIN }} | |
| TF_VAR_deployed_by: ${{ github.actor }} | |
| TF_VAR_git_sha: ${{ github.sha }} | |
| TF_VAR_api_key: ${{ secrets.LIVE_API_KEY }} | |
| TF_VAR_discord_webhook_url: ${{ secrets.DISCORD_ALERTS_WEBHOOK_URL }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Create Release PR or Deploy | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| title: "chore(release): version packages" | |
| commit: "chore(release): version packages" | |
| version: bun run changeset:version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Deploy to production when changesets are released | |
| - name: Deploy to Production | |
| if: steps.changesets.outputs.hasChangesets == 'false' | |
| uses: ./.github/actions/deploy | |
| with: | |
| environment: live | |
| aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| - name: Create GitHub Release | |
| if: steps.changesets.outputs.hasChangesets == 'false' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); | |
| const version = pkg.version; | |
| const tag = `v${version}`; | |
| // Check if tag already exists | |
| try { | |
| await github.rest.git.getRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: `tags/${tag}` | |
| }); | |
| console.log(`Tag ${tag} already exists, skipping release`); | |
| return; | |
| } catch (e) { | |
| // Tag doesn't exist, create release | |
| } | |
| // Create tag | |
| await github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: `refs/tags/${tag}`, | |
| sha: context.sha | |
| }); | |
| // Create release | |
| await github.rest.repos.createRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag_name: tag, | |
| name: `Release ${tag}`, | |
| body: `## What's Changed\n\nSee [CHANGELOG.md](./CHANGELOG.md) for details.`, | |
| draft: false, | |
| prerelease: false | |
| }); | |