|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + packages: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + name: Create Release |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Setup Node.js |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: '20' |
| 25 | + cache: 'npm' |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: npm ci |
| 29 | + |
| 30 | + - name: Build packages |
| 31 | + run: npm run build |
| 32 | + |
| 33 | + - name: Run tests |
| 34 | + run: npm run test |
| 35 | + |
| 36 | + - name: Generate changelog |
| 37 | + id: changelog |
| 38 | + run: | |
| 39 | + # Extract version from tag |
| 40 | + VERSION=${GITHUB_REF#refs/tags/v} |
| 41 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 42 | +
|
| 43 | + - name: Create GitHub Release |
| 44 | + uses: softprops/action-gh-release@v1 |
| 45 | + with: |
| 46 | + generate_release_notes: true |
| 47 | + draft: false |
| 48 | + prerelease: ${{ contains(github.ref, '-') }} |
| 49 | + |
| 50 | + docker-publish: |
| 51 | + name: Publish Docker Images |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: release |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Set up Docker Buildx |
| 58 | + uses: docker/setup-buildx-action@v3 |
| 59 | + |
| 60 | + - name: Login to GitHub Container Registry |
| 61 | + uses: docker/login-action@v3 |
| 62 | + with: |
| 63 | + registry: ghcr.io |
| 64 | + username: ${{ github.actor }} |
| 65 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Extract metadata |
| 68 | + id: meta |
| 69 | + uses: docker/metadata-action@v5 |
| 70 | + with: |
| 71 | + images: | |
| 72 | + ghcr.io/${{ github.repository }}/frontend |
| 73 | + ghcr.io/${{ github.repository }}/backend |
| 74 | + tags: | |
| 75 | + type=semver,pattern={{version}} |
| 76 | + type=semver,pattern={{major}}.{{minor}} |
| 77 | + type=semver,pattern={{major}} |
| 78 | +
|
| 79 | + - name: Build and push frontend |
| 80 | + uses: docker/build-push-action@v5 |
| 81 | + with: |
| 82 | + context: ./honeycomb |
| 83 | + push: true |
| 84 | + tags: ghcr.io/${{ github.repository }}/frontend:${{ github.ref_name }} |
| 85 | + cache-from: type=gha |
| 86 | + cache-to: type=gha,mode=max |
| 87 | + |
| 88 | + - name: Build and push backend |
| 89 | + uses: docker/build-push-action@v5 |
| 90 | + with: |
| 91 | + context: ./hive |
| 92 | + push: true |
| 93 | + tags: ghcr.io/${{ github.repository }}/backend:${{ github.ref_name }} |
| 94 | + cache-from: type=gha |
| 95 | + cache-to: type=gha,mode=max |
0 commit comments