aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yaml
diff options
context:
space:
mode:
authorCalum MacRae <hi@cmacr.ae>2021-07-10 10:25:16 +0100
committerCalum MacRae <hi@cmacr.ae>2021-07-10 10:51:18 +0100
commit33dd6ea35e199c4a22398088f4e1e3f7dca47da2 (patch)
tree09458c4165c89ad7b703fa420e75fc4ef2008b10 /.github/workflows/release.yaml
parent5a6563d9fd995c2ffecedecd0d261f367505d576 (diff)
downloadseaweedfs-csi-driver-33dd6ea35e199c4a22398088f4e1e3f7dca47da2.tar.xz
seaweedfs-csi-driver-33dd6ea35e199c4a22398088f4e1e3f7dca47da2.zip
CI: Add release pipeline
Closes #17
Diffstat (limited to '.github/workflows/release.yaml')
-rw-r--r--.github/workflows/release.yaml105
1 files changed, 105 insertions, 0 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..da3b3ed
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,105 @@
+name: Build & release Docker images
+
+on:
+ push:
+ branches:
+ - "**"
+ tags:
+ - 'v*'
+ paths:
+ - 'cmd/seaweedfs-csi-driver/Dockerfile'
+ - 'cmd/seaweedfs-csi-driver/*.go'
+ - 'pkg/driver/**'
+ - 'go.*'
+ - '.github/**'
+
+ # Build on PR
+ pull_request:
+
+ # Allow trigger for external PRs
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Fetch history
+ run: git fetch --prune --unshallow
+
+ - name: Configure Git
+ run: |
+ git config user.name "$GITHUB_ACTOR"
+ git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
+
+ - name: Get the current tag name
+ run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
+
+ - name: Setup QEMU
+ uses: docker/setup-qemu-action@v1
+
+ - name: Setup Docker Buildx
+ uses: docker/setup-buildx-action@v1
+
+ - name: Login to DockerHub
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Login to GitHub Container Registry
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GHCR_TOKEN }}
+
+ - name: Annotate Docker images
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
+ id: docker_meta
+ uses: crazy-max/ghaction-docker-meta@v1
+ with:
+ images: ${{ github.repository }}
+
+ - name: Build Docker image
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ file: ./cmd/seaweedfs-csi-driver/Dockerfile
+ platforms: linux/amd64
+ push: false
+ labels: ${{ steps.docker_meta.outputs.labels }}
+ tags: ${{ github.repository }}:${{ env.RELEASE_VERSION }}
+
+ - name: Publish Docker image to DockerHub & GitHub Container Registry
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ file: ./cmd/seaweedfs-csi-driver/Dockerfile
+ platforms: linux/amd64
+ push: ${{ startsWith(github.ref, 'refs/tags/') }}
+ labels: ${{ steps.docker_meta.outputs.labels }}
+ tags: |
+ ${{ github.repository }}:${{ env.RELEASE_VERSION }}
+ ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}
+
+ - name: Update DockerHub repo description
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
+ uses: peter-evans/dockerhub-description@v2
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_PASSWORD }}
+ repository: ${{ github.repository }}
+
+ - name: Create Release
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ github.ref }}
+ release_name: Release ${{ env.RELEASE_VERSION }}