feat: crunch lock (#104) #393
This file contains 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"] | |
pull_request: | |
branches: ["main"] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
docker-build: | |
name: Docker Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker Build | |
run: docker build -t sidekick . | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Push | |
run: | | |
docker tag sidekick:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA | |
docker-build-main: | |
name: Docker Build Latest Main | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: docker-build | |
permissions: | |
contents: read | |
packages: write | |
actions: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Turnstyle | |
uses: softprops/turnstyle@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Push | |
run: | | |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA | |
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
release: | |
name: Release Please | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
contents: write | |
pull-requests: write | |
outputs: | |
release_created: ${{ steps.release-please.outputs.release_created }} | |
tag_name: ${{ steps.release-please.outputs.tag_name }} | |
major: ${{ steps.release-please.outputs.major }} | |
minor: ${{ steps.release-please.outputs.minor}} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release-please | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: go | |
bump-minor-pre-major: true | |
bump-patch-for-minor-pre-major: true | |
extra-files: "cmd/version.md" | |
release-tags: | |
name: Release Tags | |
runs-on: ubuntu-latest | |
needs: [release, docker-build] | |
if: ${{ needs.release.outputs.release_created }} | |
permissions: | |
contents: write | |
packages: write | |
actions: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Tag major and minor versions | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git" | |
git tag -d v${{ needs.release.outputs.major }} || true | |
git tag -d v${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }} || true | |
git push origin :v${{ needs.release.outputs.major }} || true | |
git push origin :v${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }} || true | |
git tag -a v${{ needs.release.outputs.major }} -m "Release v${{ needs.release.outputs.major }}" | |
git tag -a v${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }} -m "Release v${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }}" | |
git push origin v${{ needs.release.outputs.major }} | |
git push origin v${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }} | |
- name: Turnstyle | |
uses: softprops/turnstyle@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Push | |
run: | | |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA | |
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release.outputs.tag_name }} | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release.outputs.tag_name }} | |
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ needs.release.outputs.major }} | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ needs.release.outputs.major }} | |
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:commit-$GITHUB_SHA ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }} | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }} | |
release-bins: | |
name: Release Bins | |
runs-on: ubuntu-latest | |
needs: release | |
if: ${{ needs.release.outputs.release_created }} | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: [amd64, arm64] | |
exclude: | |
- goarch: arm64 | |
goos: windows | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wangyoucao577/go-release-action@v1 | |
with: | |
overwrite: yes | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
goos: ${{ matrix.goos }} | |
goarch: ${{ matrix.goarch }} | |
goversion: "1.20" | |
release_tag: ${{ needs.release.outputs.tag_name }} | |
md5sum: false | |
asset_name: sidekick-${{ matrix.goos }}-${{ matrix.goarch }} |