From 424bf8ba6c82923d7b23867651ccef7a4be89021 Mon Sep 17 00:00:00 2001
From: Yoann Fleury <yoann.fleury@yahoo.com>
Date: Sat, 17 Oct 2020 17:12:28 +0200
Subject: [PATCH] ci: update the way assets are uploaded

---
 .github/workflows/publish.yaml | 58 +++++++++++++++++++++-------------
 CHANGELOG.md                   |  6 ++++
 Cargo.lock                     |  2 +-
 Cargo.toml                     |  2 +-
 4 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index 190ef22..d880874 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -3,7 +3,7 @@ name: Publish
 on:
   push:
     tags:
-     - '*'
+     - 'v*'
 
 jobs:
   publish_on_crates_io:
@@ -24,6 +24,14 @@ jobs:
         uses: actions-rs/cargo@v1
         with:
           command: publish
+      - name: Create Release
+        id: create_release
+        uses: actions/create-release@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          tag_name: ${{ github.ref }}
+          release_name: Release ${{ github.ref }}
 
   release_linux:
     needs: publish_on_crates_io
@@ -36,14 +44,16 @@ jobs:
         with:
           command: build
           args: --release
-      - name: Release Linux binary
-        uses: meeDamian/github-release@2.0
-        if: startsWith(github.ref, 'refs/tags/')
+      - name: Upload Release Asset Linux
+        id: upload-release-asset-linux
+        uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         with:
-          gzip: false
-          files: >
-            gitweb-linux:target/release/gitweb
-          token: ${{ secrets.GITHUB_TOKEN }}
+          upload_url: ${{ steps.create_release.outputs.upload_url }}
+          asset_path: ./target/release/gitweb
+          asset_name: gitweb-linux
+          asset_content_type: application/x-sharedlib
 
   release_windows:
     needs: publish_on_crates_io
@@ -56,14 +66,16 @@ jobs:
         with:
           command: build
           args: --release
-      - name: Release Windows binary
-        uses: meeDamian/github-release@2.0
-        if: startsWith(github.ref, 'refs/tags/')
+      - name: Upload Release Asset Windows
+        id: upload-release-asset-windows
+        uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         with:
-          gzip: false
-          files: >
-            gitweb-windows:target/release/gitweb.exe
-          token: ${{ secrets.GITHUB_TOKEN }}
+          upload_url: ${{ steps.create_release.outputs.upload_url }}
+          asset_path: ./target/release/gitweb.exe
+          asset_name: gitweb-windows.exe
+          asset_content_type: application/x-dosexec
 
   release_macos:
     needs: publish_on_crates_io
@@ -76,11 +88,13 @@ jobs:
         with:
           command: build
           args: --release
-      - name: Release MacOS binary
-        uses: meeDamian/github-release@2.0
-        if: startsWith(github.ref, 'refs/tags/')
+      - name: Upload Release Asset MacOS
+        id: upload-release-asset-macos
+        uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         with:
-          gzip: false
-          files: >
-            gitweb-macos:target/release/gitweb
-          token: ${{ secrets.GITHUB_TOKEN }}
+          upload_url: ${{ steps.create_release.outputs.upload_url }}
+          asset_path: ./target/release/gitweb
+          asset_name: gitweb-macos
+          asset_content_type: application/x-mach-binary
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4232c1c..00cc371 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [0.2.4] - 2020-10-17
+
+### Changed
+
+- ci: update the way assets are uploaded
+
 ## [0.2.3] - 2020-10-14
 
 ### Changed
diff --git a/Cargo.lock b/Cargo.lock
index f77d096..dd9670d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -123,7 +123,7 @@ dependencies = [
 
 [[package]]
 name = "gitweb"
-version = "0.2.3"
+version = "0.2.4"
 dependencies = [
  "anyhow",
  "flexi_logger",
diff --git a/Cargo.toml b/Cargo.toml
index 0f0e962..19aac3e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "gitweb"
-version = "0.2.3"
+version = "0.2.4"
 authors = ["Yoann Fleury <yoann.fleury@yahoo.com>"]
 edition = "2018"
 description = "Open the current remote repository in your browser"