Skip to content

Commit

Permalink
Create cd.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-robbins authored Nov 21, 2023
1 parent aaffd29 commit d870c6f
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: CD

on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: SebRollen/[email protected]
id: version
with:
file: 'Cargo.toml'
field: 'package.version'

- id: tag_check
run: |
[[ $(git tag | grep "v${{ steps.version.outputs.value }}") == '' ]]
# Only create a release when the above version isn't already tagged
# aka a new release
- id: create_release
if: ${{ success() }}
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: v${{ steps.version.outputs.value }}
name: Release v${{ steps.version.outputs.value }}
generate_release_notes: true

outputs:
tag_check: ${{ steps.tag_check.conclusion }}
version: ${{ steps.version.outputs.value }}
release_upload_url: ${{ steps.create_release.outputs.upload_url }}

build:
runs-on: ubuntu-latest
needs: release

steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build
run: cargo build --release --all-features
- name: upload release binary
if: ${{ success() }}
id: upload_release_binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.release_upload_url }}
asset_path: ./target/release/stignore-agent
asset_name: stignore-agent
asset_content_type: application/octet-stream

0 comments on commit d870c6f

Please sign in to comment.