Skip to content

Commit

Permalink
Feat/add gh versionning (#1)
Browse files Browse the repository at this point in the history
Feat/add gh action versionning
  • Loading branch information
ayoub3bidi authored Feb 21, 2024
1 parent a64f88a commit ea5bb67
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Create release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
release:
name: Release pushed tag
runs-on: ubuntu-22.04
steps:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${tag#v}" \
--generate-notes
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine:3.19

ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 comwork.io

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
# gh-versioning
# Comwork Apps Versionning

👋 Welcome to Comwork Apps Versionning!

This action checks if a GitHub release exists for the version specified in the `VERSION` file of your repository. If the release does not exist, it creates a new one.

## Inputs

This action does not require any inputs.

## Outputs

This action does not produce any outputs.

## Example usage

```yaml
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Check and create release
uses: comworkio/gh-versioning@version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: 'Comwork apps versionning'
description: 'Checks and creates a release'
runs:
using: 'docker'
image: 'Dockerfile'
12 changes: 12 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

VERSION="$(cat VERSION)"
echo "Version: $VERSION"
if gh release view "v$VERSION" --repo="$GITHUB_REPOSITORY" > /dev/null 2>&1; then
echo "Release v$VERSION already exists"
else
gh release create "v$VERSION" \
--repo="$GITHUB_REPOSITORY" \
--title="Version $VERSION" \
--generate-notes
fi

0 comments on commit ea5bb67

Please sign in to comment.