-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from duplocloud/releaser
Releaser
- Loading branch information
Showing
6 changed files
with
99 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Releaser | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
releaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Dist Dir | ||
id: dist_dir | ||
run: mkdir -p dist artifacts | ||
|
||
- name: Get Tag Name | ||
id: set_tag | ||
run: | | ||
GIT_TAG=${GITHUB_REF#refs/*/} | ||
VERSION=$(echo $GIT_TAG | cut -d'v' -f2) | ||
NAME="duploctl-${GIT_TAG}" | ||
echo "GIT_TAG=${GIT_TAG}" >> $GITHUB_OUTPUT | ||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
echo "NAME=${NAME}" >> $GITHUB_OUTPUT | ||
- name: Build Release Message | ||
id: message | ||
env: | ||
GIT_TAG: ${{ steps.set_tag.outputs.GIT_TAG }} | ||
VERSION: ${{ steps.set_tag.outputs.VERSION }} | ||
run: | | ||
MESSAGE="$(cat <<EOF | ||
duploctl ${GIT_TAG} is out!. | ||
PyPi: | ||
[duplocloud-client](https://pypi.org/project/duplocloud-client/${VERSION}/) | ||
```sh | ||
pip install duplocloud-client==${VERSION} | ||
``` | ||
Dockerhub: | ||
[duplocloud/duploctl:${GIT_TAG}](https://hub.docker.com/r/duplocloud/duploctl) | ||
```sh | ||
docker pull duplocloud/duploctl:${GIT_TAG} | ||
``` | ||
EOF | ||
)" | ||
echo "MESSAGE=${MESSAGE}" >> $GITHUB_OUTPUT | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: ${{ steps.set_tag.outputs.NAME }}-* | ||
path: artifacts | ||
merge-multiple: false | ||
|
||
- name: Compress Artifacts | ||
shell: bash | ||
run: | | ||
for d in artifacts/*; do | ||
name=$(basename $d) | ||
dest="dist/${name}.tar.gz" | ||
tar -czvf "$dest" -C $d . | ||
done | ||
- name: Create Release | ||
id: release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: | | ||
dist/* | ||
body: ${{ steps.message.outputs.MESSAGE }} | ||
prerelease: ${{ github.event.inputs.prerelease }} | ||
|
||
- name: Post to a Slack channel | ||
id: slack | ||
uses: slackapi/[email protected] | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
channel-id: ${{ vars.SLACK_CHANNEL_ID }} | ||
slack-message: | | ||
duploctl ${{ steps.set_tag.outputs.GIT_TAG }} is out! | ||
${{ steps.release.outputs.url }} | ||
- name: Job Summary | ||
env: | ||
MESSAGE: ${{ steps.message.outputs.MESSAGE }} | ||
run: echo "$MESSAGE" >> $GITHUB_STEP_SUMMARY | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,5 +57,5 @@ coll = COLLECT( | |
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='cli', | ||
name='duplocloud', | ||
) |