Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
ci: adding automated release creating
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperC286 committed May 19, 2023
1 parent 1236a8a commit 290c182
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/releasing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Releasing
on:
push:
branches: [main]
permissions:
contents: write
jobs:
Releasing:
runs-on: ubuntu-latest
steps:
- name: Download Earthly v0.7.5.
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.5/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Checkout code.
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Releasing.
run: earthly --ci --secret GH_TOKEN +releasing
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by GitHub Actions.
11 changes: 11 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,14 @@ unit-testing:
DO +INSTALL_DEPENDENCIES
DO +COPY_SOURCECODE
RUN ./ci/unit-testing.sh


releasing:
FROM ubuntu
RUN apt-get update
RUN apt-get install wget git -y
RUN wget https://github.com/cli/cli/releases/download/v2.29.0/gh_2.29.0_linux_amd64.tar.gz
RUN tar -xzvf gh_2.29.0_linux_amd64.tar.gz
RUN cp ./gh_2.29.0_linux_amd64/bin/gh /bin/gh
DO +COPY_METADATA
RUN --secret GH_TOKEN ./ci/releasing.sh
17 changes: 17 additions & 0 deletions ci/releasing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

set -o errexit
set -o xtrace

# Get current version.
current_version=$(cat "VERSION")
# If the tag already exist then exit.
git tag -l | grep -q "^${current_version}$" && exit 0
# Where to start generating the release notes from.
base_commit=$(git rev-list --max-parents=0 HEAD)
latest_tag=$(git describe --exact-match --tags || echo "")
notes_from="${latest_tag:-${base_commit}}"
# Generate the release notes.
release_notes=$(git log --format="* %s" ${notes_from}.. --no-merges)
# Create release and the tag.
gh release create "${current_version}" --notes "${release_notes}"

0 comments on commit 290c182

Please sign in to comment.