Skip to content

Commit

Permalink
Resolve warnings on Github Actions workflow and include script on rel…
Browse files Browse the repository at this point in the history
…eases
  • Loading branch information
davidfb committed May 5, 2023
1 parent da767d3 commit 0e11f3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
51 changes: 17 additions & 34 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,13 @@ jobs:

runs-on: ubuntu-22.04

outputs:
release_id: ${{ steps.create_release.outputs.id }}
release_upload_url: ${{ steps.create_release.outputs.upload_url }}

steps:
- uses: actions/checkout@v3

- name: Create draft
id: create_release
uses: actions/create-release@v1
run: gh release create $GITHUB_REF_NAME --draft=true --title $GITHUB_REF_NAME zabbix-varnish-cache.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

upload_assets:
name: Upload assets
Expand All @@ -45,10 +37,10 @@ jobs:
slug: varnish-cache

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -57,27 +49,23 @@ jobs:
python -m pip install --upgrade pip
pip install jinja2-cli
- name: Extract tag name
run: echo "TAG_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Build template file name
run: |
echo "TEMPLATE_FILE_NAME=template-app-${{ matrix.flavour.slug }}-${{ matrix.version }}-$GITHUB_REF_NAME.xml" >> $GITHUB_ENV
- name: Generate template
run: |
PYTHONPATH=. jinja2 \
-D version=${{ matrix.version }} \
-D name='${{ matrix.flavour.name }}' \
-D description="Template App ${{ matrix.flavour.name }} $TAG_NAME" \
-D release="${TAG_NAME:1}" \
--extension=extensions.zabbix.ZabbixExtension --strict -o template.xml template-app-varnish-cache.j2
-D description="Template App ${{ matrix.flavour.name }} $GITHUB_REF_NAME" \
-D release="${GITHUB_REF_NAME:1}" \
--extension=extensions.zabbix.ZabbixExtension --strict -o $TEMPLATE_FILE_NAME template-app-varnish-cache.j2
- name: Upload template
uses: actions/upload-release-asset@v1
run: gh release upload $GITHUB_REF_NAME $TEMPLATE_FILE_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.release_upload_url }}
asset_path: ./template.xml
asset_name: template-app-${{ matrix.flavour.slug }}-${{ matrix.version }}-${{ env.TAG_NAME }}.xml
asset_content_type: application/xml

publish_release:
name: Publish release
Expand All @@ -89,14 +77,9 @@ jobs:
- upload_assets

steps:
- uses: actions/checkout@v3

- name: Publish release
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: '${{ needs.create_release.outputs.release_id }}',
draft: false
})
run: gh release edit $GITHUB_REF_NAME --draft=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- ?:
- Resolve warnings on Github Actions workflow and include script on releases.

- 20.0 (2023-05-03):
- Added 'MAIN.n_object_hitmiss' and 'MAIN.n_object_hitpass'.

Expand Down

0 comments on commit 0e11f3f

Please sign in to comment.