Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaouari authored Dec 21, 2022
1 parent 746d4d2 commit 97ec7e3
Showing 1 changed file with 47 additions and 15 deletions.
62 changes: 47 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
name: Publish
name: Release

on:
push:
tags:
- '*'
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Publish binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --release
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "{manifest.json,data.json}"
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- uses: actions/checkout@v2
- name: Extract version from commit message
id: ver
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
echo "Commit message: $COMMIT_MESSAGE"
if [[ $COMMIT_MESSAGE =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "version=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
else
echo "exit no version x.x.x in the commit message"
exit 1
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.ver.outputs.version }}
release_name: ${{ steps.ver.outputs.version }}
draft: false
prerelease: false
- name: Attach data.json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: data.json
asset_name: data.json
asset_content_type: application/json
- name: Attach manifest.json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: manifest.json
asset_name: manifest.json
asset_content_type: application/json

0 comments on commit 97ec7e3

Please sign in to comment.