name: Release on: push: tags: - 'v*' jobs: build: name: Build and Release runs-on: ubuntu-latest permissions: contents: write packages: write steps: - name: Checkout code uses: actions/checkout@v3 - name: Install Crystal uses: crystal-lang/install-crystal@v1 with: crystal_version: 1.9.2 - name: Install dependencies run: shards install - name: Build binary run: crystal build --release src/main.cr -o bin/container-mom-operator - name: Build Docker image run: docker build -t ghcr.io/${{ github.repository }}:${{ github.ref_name }} . - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Push Docker image run: | docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} docker tag ghcr.io/${{ github.repository }}:${{ github.ref_name }} ghcr.io/${{ github.repository }}:latest docker push ghcr.io/${{ github.repository }}:latest - name: Create Release uses: softprops/action-gh-release@v1 with: name: Release ${{ github.ref_name }} draft: false prerelease: false files: | bin/container-mom-operator LICENSE README.md