Skip to content

Commit

Permalink
symantics
Browse files Browse the repository at this point in the history
  • Loading branch information
kferrone committed Mar 8, 2024
1 parent 37dc9b5 commit 9b62b97
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 104 deletions.
76 changes: 0 additions & 76 deletions .github/workflows/installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@ name: Publish Release

on:
workflow_dispatch:
inputs:
prerelease:
description: Is this a prerelease?
required: false
default: true
type: boolean
workflow_call:
inputs:
prerelease:
description: Is this a prerelease?
required: false
default: true
type: boolean

jobs:
installer:
Expand Down Expand Up @@ -63,67 +51,3 @@ jobs:
with:
name: ${{ steps.set_tag.outputs.NAME }}
path: dist/duplocloud

releaser:
name: Release
runs-on: ubuntu-latest
needs: installer
outputs:
name: ${{ steps.set_tag.outputs.NAME }}
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: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{ steps.set_tag.outputs.NAME }}-*
path: artifacts
merge-multiple: false

- name: Prep Release
shell: bash
run: |
for d in artifacts/*; do
name=$(basename $d)
dest="dist/${name}.tar.gz"
tar -czvf "$dest" -C $d .
echo "Dir: $d"
ls $d
done
ls dist
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/*
body: |
duploctl ${{ steps.set_tag.outputs.GIT_TAG }} is out!.
PyPi:
[duplocloud-client](https://pypi.org/project/duplocloud-client/${{ steps.set_tag.outputs.VERSION }}/)
```sh
pip install duplocloud-client==${{ steps.set_tag.outputs.VERSION }}
```
Dockerhub:
[duplocloud/duploctl:${{ steps.set_tag.outputs.GIT_TAG }}](https://hub.docker.com/r/duplocloud/duploctl)
```sh
docker pull duplocloud/duploctl:${{ steps.set_tag.outputs.GIT_TAG }}
```
prerelease: ${{ github.event.inputs.prerelease }}
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish Version
on:
push:
tags:
- '*'
- 'v*'

jobs:

Expand All @@ -22,8 +22,8 @@ jobs:
uses: ./.github/workflows/installer.yml
secrets: inherit

notify:
name: Slack notify
uses: ./.github/workflows/slack-notify.yml
release:
name: Release
uses: ./.github/workflows/release.yml
secrets: inherit
needs: [package, installer, image]
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
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

24 changes: 0 additions & 24 deletions .github/workflows/slack-notify.yml

This file was deleted.

0 comments on commit 9b62b97

Please sign in to comment.