|
| 1 | +name: Chack code and publish on master push |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + paths: |
| 8 | + - "*.py" |
| 9 | + |
| 10 | +jobs: |
| 11 | + check: |
| 12 | + name: Code check |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v3 |
| 17 | + - name: Set up Python |
| 18 | + uses: actions/setup-python@v3 |
| 19 | + with: |
| 20 | + python-version: "3.10" |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip |
| 24 | + pip install pylint |
| 25 | + - name: Analysing the code with pylint |
| 26 | + run: pylint $(git ls-files '*.py') |
| 27 | + publish: |
| 28 | + needs: check |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v3 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + - name: Setup GitVersion |
| 36 | + uses: gittools/actions/gitversion/[email protected] |
| 37 | + with: |
| 38 | + versionSpec: 5.x |
| 39 | + - name: Determine Version |
| 40 | + uses: gittools/actions/gitversion/[email protected] |
| 41 | + id: gitversion |
| 42 | + with: |
| 43 | + useConfigFile: true |
| 44 | + configFilePath: ./.github/config/gitversion.yml |
| 45 | + - name: Create zip |
| 46 | + uses: ihiroky/archive-action@v1 |
| 47 | + with: |
| 48 | + root_dir: ./ |
| 49 | + file_path: ipsec_exporter_${{steps.gitversion.outputs.version}}.zip |
| 50 | + - name: Create tar.gz |
| 51 | + uses: ihiroky/archive-action@v1 |
| 52 | + with: |
| 53 | + root_dir: ./ |
| 54 | + file_path: ipsec_exporter_${{steps.gitversion.outputs.version}}.tar.gz |
| 55 | + - name: Create Release |
| 56 | + id: create_release |
| 57 | + uses: actions/create-release@v1 |
| 58 | + env: |
| 59 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + with: |
| 61 | + tag_name: ${{steps.gitversion.outputs.version}} |
| 62 | + release_name: ${{steps.gitversion.outputs.version}} |
| 63 | + body_path: ./RELEASE.md |
| 64 | + draft: false |
| 65 | + prerelease: false |
| 66 | + - name: Upload zip archive |
| 67 | + uses: actions/upload-release-asset@v1 |
| 68 | + env: |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + with: |
| 71 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 72 | + asset_path: ./ipsec_exporter_${{steps.gitversion.outputs.version}}.zip |
| 73 | + asset_name: ipsec_exporter_${{steps.gitversion.outputs.version}}.zip |
| 74 | + asset_content_type: application/zip |
| 75 | + - name: Upload tar.gz archive |
| 76 | + uses: actions/upload-release-asset@v1 |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + with: |
| 80 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 81 | + asset_path: ./ipsec_exporter_${{steps.gitversion.outputs.version}}.tar.gz |
| 82 | + asset_name: ipsec_exporter_${{steps.gitversion.outputs.version}}.tar.gz |
| 83 | + asset_content_type: application/gzip |
| 84 | + |
0 commit comments