Skip to content

Release

Release #126

Workflow file for this run

name: Release
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * 2' # every Tuesday at 9 am UTC
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '1.8'
- name: Set up GitHub actions user
uses: fregante/setup-git-user@v1
- name: Create release tag
id: createTag
run: |
TAG_NAME="v$(date +%Y%m%d.%H%M%S)"
git tag
git push --tags
echo "::set-output name=tagName::$TAG_NAME"
- name: Build with Maven
env:
TAG_NAME: ${{ steps.createTag.outputs.tagName }}
run: |
./update-cli.sh
./mvnw clean verify --show-version --batch-mode --errors -Drevision=${TAG_NAME}
sha256sum ./distribution/target/teamcity-snyk-security-plugin.zip > ./distribution/target/teamcity-snyk-security-plugin.zip.sha256
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Create release
id: create_release
if: ${{ !env.ACT }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ steps.createTag.outputs.tagName }}"
release_name: "${{ steps.createTag.outputs.tagName }}"
draft: false
prerelease: false
body: '${{ steps.extract-release-notes.outputs.release_notes }}'
- name: Upload plugin zip asset
id: upload-release-asset-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./distribution/target/teamcity-snyk-security-plugin.zip
asset_name: "teamcity-snyk-security-plugin.zip"
asset_content_type: application/zip
- name: Upload plugin sha asset
id: upload-release-asset-sha
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./distribution/target/teamcity-snyk-security-plugin.zip.sha256
asset_name: "teamcity-snyk-security-plugin.zip.sha256"
asset_content_type: application/text
- name: Deploy plugin to JetBrains portal
env:
JETBRAINS_PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
run: |
echo "Deploying the plugin to JetBrains portal..."
curl -i --header "Authorization: Bearer ${JETBRAINS_PUBLISH_TOKEN}" -F pluginId=12227 -F file=@distribution/target/teamcity-snyk-security-plugin.zip https://plugins.jetbrains.com/plugin/uploadPlugin