From 63c658384fa82ab10619efd69e3f4b1994b72dd5 Mon Sep 17 00:00:00 2001
From: Vitaliy Filippov <vitalif@yourcmc.ru>
Date: Tue, 24 Aug 2021 14:03:09 +0300
Subject: [PATCH] Add release action

---
 .github/workflows/release.yml | 21 +++++++++++++++++++++
 Makefile                      |  2 ++
 2 files changed, 23 insertions(+)
 create mode 100644 .github/workflows/release.yml

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..d3b2d76
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,21 @@
+name: Release
+
+on:
+  push:
+    tags:
+    - "v*"
+
+jobs:
+
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+
+    - name: Push Docker
+      run: (echo '${{ secrets.REGISTRY_KEY }}' | docker login --username json_key --password-stdin cr.yandex) && make push
+
+    - uses: "marvinpinto/action-automatic-releases@latest"
+      with:
+        repo_token: "${{ secrets.GITHUB_TOKEN }}"
+        prerelease: false
diff --git a/Makefile b/Makefile
index d9c95d4..6e9b552 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,9 @@ test:
 container:
 	docker build -t $(IMAGE_TAG) -f cmd/s3driver/Dockerfile .
 push: container
+	docker tag $(IMAGE_TAG) $(REGISTRY_NAME)/$(IMAGE_NAME):latest
 	docker push $(IMAGE_TAG)
+	docker push $(REGISTRY_NAME)/$(IMAGE_NAME)
 clean:
 	go clean -r -x
 	-rm -rf _output