97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
name: Chack code and publish on master push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
paths:
|
|
- "src/*.py"
|
|
- "*.py"
|
|
|
|
jobs:
|
|
check:
|
|
name: Code check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: "3.10"
|
|
- name: Setup GitVersion
|
|
uses: gittools/actions/gitversion/setup@v0.9.7
|
|
with:
|
|
versionSpec: 5.x
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pylint
|
|
- name: Analysing the code with pylint
|
|
run: pylint --exit-zero $(git ls-files '*.py')
|
|
- name: Determine Version
|
|
uses: gittools/actions/gitversion/execute@v0.9.7
|
|
id: gitversion
|
|
with:
|
|
useConfigFile: true
|
|
configFilePath: ./.github/config/gitversion.yml
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: nuget
|
|
path: |
|
|
./
|
|
!./.github/
|
|
!./.gitignore
|
|
outputs:
|
|
version: ${{ steps.gitversion.outputs.SemVer }}
|
|
publish:
|
|
needs: check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: nuget
|
|
path: ./
|
|
- name: Create zip
|
|
uses: ihiroky/archive-action@v1
|
|
with:
|
|
root_dir: ./
|
|
file_path: ipsec_exporter_${{needs.build.outputs.version}}.zip
|
|
- name: Create tar.gz
|
|
uses: ihiroky/archive-action@v1
|
|
with:
|
|
root_dir: ./
|
|
file_path: ipsec_exporter_${{needs.build.outputs.version}}.tar.gz
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{needs.build.outputs.version}}
|
|
release_name: ${{needs.build.outputs.version}}
|
|
body_path: ./RELEASE.md
|
|
draft: false
|
|
prerelease: false
|
|
- name: Upload zip archive
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./ipsec_exporter_${{needs.build.outputs.version}}.zip
|
|
asset_name: ipsec_exporter_${{needs.build.outputs.version}}.zip
|
|
asset_content_type: application/zip
|
|
- name: Upload tar.gz archive
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./ipsec_exporter_${{needs.build.outputs.version}}.tar.gz
|
|
asset_name: ipsec_exporter_${{needs.build.outputs.version}}.tar.gz
|
|
asset_content_type: application/gzip
|
|
|