Skip to content

Commit

Permalink
chore(ci): improved release action
Browse files Browse the repository at this point in the history
  • Loading branch information
kilip committed Aug 18, 2024
1 parent 44e9039 commit e468406
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Release"

on:
Expand All @@ -9,15 +8,18 @@ on:

jobs:
release:
if: ${{ github.repository == 'kilip/homeplay' }}
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create Release
- name: Setup workflow variables
shell: bash
id: vars
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
Expand All @@ -36,9 +38,27 @@ jobs:
echo "Month release does not exist for year, setting patch number to 0"
next_patch="0"
fi
# Create release
release_tag="${next_major_minor}.${next_patch}"
gh release create "${release_tag}" \
--repo="${GITHUB_REPOSITORY}" \
--title="${release_tag}" \
--generate-notes
echo "release_tag=${release_tag}" >> $GITHUB_OUTPUT
echo "previous_tag=${previous_tag}" >> $GITHUB_OUTPUT
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
toTag: ${{ steps.vars.outputs.previous_tag }}
fromTag: ${{ steps.vars.outputs.release_tag }}

- name: Create Release
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ steps }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"*.conf.sops": "toml"
},
"sops.defaults.ageKeyFile": "age.key",
"ansible.python.interpreterPath": "/home/toni/code/homeplay/.venv/bin/python"
"ansible.python.interpreterPath": "/home/toni/code/homeplay/.venv/bin/python",
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "file:///home/toni/code/homeplay/.github/workflows/release.yaml"
}
}
18 changes: 10 additions & 8 deletions play-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
ansible.builtin.include_role:
name: service
tags: always
- name: Ensure unused docker resources pruned
community.docker.docker_prune:
containers: true
images: true
networks: true
volumes: true
builder_cache: true
tags: prune
- name: Ensure unused docker image pruned
ansible.builtin.command:
argv:
- docker
- image
- prune
- -a
- -f
changed_when: false
tags: prune,always

0 comments on commit e468406

Please sign in to comment.