From b5a9cca932970950598b9a0893cb18f17762b3c6 Mon Sep 17 00:00:00 2001 From: devthejo Date: Wed, 31 Aug 2022 22:50:09 +0200 Subject: [PATCH] feat: github ci release --- .github/workflows/docker-release.yml | 53 +++++++++++++++++++++++++++ .github/workflows/github-release.yaml | 14 +++++++ .github/workflows/go-release.yaml | 31 ++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 .github/workflows/docker-release.yml create mode 100644 .github/workflows/github-release.yaml create mode 100644 .github/workflows/go-release.yaml diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 0000000..663241a --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,53 @@ +name: Docker Release + +on: + push: + tags: + - 'v*.*.*' + +concurrency: + cancel-in-progress: true + group: docker-release-${{ github.ref_name }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + file: Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + \ No newline at end of file diff --git a/.github/workflows/github-release.yaml b/.github/workflows/github-release.yaml new file mode 100644 index 0000000..a7f0fb3 --- /dev/null +++ b/.github/workflows/github-release.yaml @@ -0,0 +1,14 @@ +name: Github Release + +on: push + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') \ No newline at end of file diff --git a/.github/workflows/go-release.yaml b/.github/workflows/go-release.yaml new file mode 100644 index 0000000..34c7b1f --- /dev/null +++ b/.github/workflows/go-release.yaml @@ -0,0 +1,31 @@ +name: Go Release + +on: + release: + types: [created] + +jobs: + releases-matrix: + name: Release Go Binary + runs-on: ubuntu-latest + strategy: + matrix: + # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 + goos: [linux, windows, darwin] + goarch: ["386", amd64, arm64] + exclude: + - goarch: "386" + goos: darwin + - goarch: arm64 + goos: windows + steps: + - uses: actions/checkout@v3 + - uses: wangyoucao577/go-release-action@v1.30 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + goversion: "https://dl.google.com/go/go1.18.linux-amd64.tar.gz" + project_path: "./cmd" + binary_name: "rollout-status" + # extra_files: LICENSE README.md \ No newline at end of file