chore: added sentry exception filter logging #222
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "publish packages" | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- 'src/**' | |
- '.github/workflows/package-publish.yaml' | |
- 'scripts/*' | |
- '*.props' | |
- '!samples' | |
jobs: | |
find-changed-packages: | |
name: "find changed packages" | |
runs-on: ubuntu-latest | |
if: ${{ github.actor != 'itmo-is-dev-ci[bot]' }} | |
outputs: | |
packages: ${{ steps.changed-packages.outputs.changed-package-projects }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: find Directory.Build.props changes | |
id: find-build | |
run: | | |
changes_count=$(git --no-pager diff ${{ github.event.before }} ${{ github.event.after }} Directory.Build.props \ | |
| grep -Ec '^\+ ') || : | |
echo changes-count="$changes_count" >> "$GITHUB_OUTPUT" | |
- name: find Directory.Packages.props changes | |
id: find-packages | |
run: | | |
source ./scripts/common-scripts.sh | |
changed_packages=$(git --no-pager diff ${{ github.event.before }} ${{ github.event.after }} Directory.Packages.props \ | |
| grep -E '^\+ ' \ | |
| get_tag_attribute_value 'Include' \ | |
| lines_to_json_array) || : | |
echo changed-packages="$changed_packages" >> "$GITHUB_OUTPUT" | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
- name: find changed package projects | |
id: find-changed-package-projects | |
if: ${{ steps.find-build.outputs.changes-count == 0 }} | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
ALL_CHANGED_DEPENDENCIES: ${{ steps.find-packages.outputs.changed-packages }} | |
run: | | |
source ./scripts/changes-scripts.sh | |
changed_package_projects=$({ | |
echo "$ALL_CHANGED_FILES" | find_changed_projects; | |
echo "$ALL_CHANGED_DEPENDENCIES" | find_changed_dependencies | |
} | sort | uniq | lines_to_json_array) | |
echo changed-package-projects="$changed_package_projects" >> "$GITHUB_OUTPUT" | |
- name: calculate final changed packages | |
id: changed-packages | |
env: | |
SELECTED_PACKAGES: ${{ steps.find-changed-package-projects.outputs.changed-package-projects }} | |
run: | | |
source ./scripts/project-scripts.sh | |
if [[ ${{ steps.find-build.outputs.changes-count }} -eq 0 ]] | |
then | |
echo changed-package-projects="$SELECTED_PACKAGES" >> "$GITHUB_OUTPUT" | |
else | |
echo changed-package-projects="$(find_package_projects | lines_to_json_array)" >> "$GITHUB_OUTPUT" | |
fi | |
commit-patches: | |
name: commit patch versions | |
runs-on: ubuntu-latest | |
needs: find-changed-packages | |
environment: itmo-is-dev-ci | |
permissions: | |
contents: write | |
if: ${{ | |
needs.find-changed-packages.outputs.packages != '[]' | |
&& needs.find-changed-packages.outputs.packages != '' | |
}} | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.ITMO_IS_DEV_CI_APP_ID }} | |
private-key: ${{ secrets.ITMO_IS_DEV_CI_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
- name: set config | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- name: change patch versions | |
env: | |
CHANGED_PACKAGES: ${{ needs.find-changed-packages.outputs.packages }} | |
run: | | |
source ./scripts/common-scripts.sh | |
source ./scripts/platform-scripts.sh | |
echo "$CHANGED_PACKAGES" | json_array_to_lines | while read -r line | |
do | |
change_package_patch_version "$line" ${{ github.run_number }} | |
done | |
- name: commit patch version changes | |
env: | |
CHANGED_PACKAGES: ${{ needs.find-changed-packages.outputs.packages }} | |
run: | | |
source ./scripts/common-scripts.sh | |
git add ./src/**/*.csproj | |
git commit -m'[deploy] commited patch #${{ github.run_number }}' -m "$(echo "$CHANGED_PACKAGES" | json_array_to_lines)" | |
git push | |
publish-package: | |
name: ${{ matrix.package }} | |
runs-on: ubuntu-latest | |
needs: | |
- find-changed-packages | |
- commit-patches | |
environment: | |
name: nuget.org | |
url: ${{ steps.deployment-url.outputs.url }} | |
if: ${{ | |
needs.find-changed-packages.outputs.packages != '[]' | |
&& needs.find-changed-packages.outputs.packages != '' | |
}} | |
strategy: | |
matrix: | |
package: ${{ fromJSON(needs.find-changed-packages.outputs.packages) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: change patch versions | |
env: | |
CHANGED_PACKAGES: ${{ needs.find-changed-packages.outputs.packages }} | |
run: | | |
source ./scripts/common-scripts.sh | |
source ./scripts/platform-scripts.sh | |
echo "$CHANGED_PACKAGES" | json_array_to_lines | while read -r line | |
do | |
change_package_patch_version "$line" ${{ github.run_number }} | |
done | |
- name: generate deployment url | |
id: deployment-url | |
run: | | |
source ./scripts/platform-scripts.sh | |
full_name=$(echo ${{ matrix.package }} | short_name_to_full_name) | |
package_version=$(get_package_version ${{ matrix.package }}) | |
url=https://www.nuget.org/packages/"$full_name"/"$package_version" | |
echo url="$url" >> "$GITHUB_OUTPUT" | |
- name: format csproj path | |
id: csproj | |
run: | | |
source ./scripts/common-scripts.sh | |
csproj_path=$(echo ${{ matrix.package }} | short_name_to_csproj_path) | |
csproj_dir=$(echo ${{ matrix.package }} | short_name_to_dir_path) | |
echo path="$csproj_path" >> "$GITHUB_OUTPUT" | |
echo dir="$csproj_dir" >> "$GITHUB_OUTPUT" | |
- name: restore | |
run: dotnet restore ${{ steps.csproj.outputs.path }} | |
- name: build | |
run: dotnet build ${{ steps.csproj.outputs.path }} -c Release --no-restore | |
- name: publish | |
run: | | |
nuget_path=$(ls ${{ steps.csproj.outputs.dir }}/bin/Release/*.nupkg) | |
dotnet nuget push "$nuget_path" --source "nuget.org" --api-key ${{ secrets.NUGET_API_KEY }} |