name: Release on: push: tags: - 'v*' permissions: contents: write packages: write jobs: release: name: Create Release runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install dependencies run: npm ci - name: Build run: npm run build --if-present - name: Generate changelog id: changelog uses: metcalfc/changelog-generator@v4.3.1 with: myToken: ${{ secrets.GITHUB_TOKEN }} - name: Create Release uses: softprops/action-gh-release@v2 with: body: | ## What's Changed ${{ steps.changelog.outputs.changelog }} ## Docker Image ``` docker pull ghcr.io/${{ github.repository }}:${{ github.ref_name }} ``` draft: false prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} docker: name: Build and Push Docker Image runs-on: ubuntu-latest needs: release steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=sha - name: Build and push uses: docker/build-push-action@v5 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max