Skip to content

Commit

Permalink
conditional build
Browse files Browse the repository at this point in the history
  • Loading branch information
unglaublicherdude committed Jul 31, 2023
1 parent 5799ea2 commit 1e14410
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 37 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci-php-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: deploy new php version

# Only trigger, when the build workflow succeeded
on:
workflow_run:
workflows: ["vaas-php-ci"]
types:
- completed

jobs:
deploy:
name: deploy new php version
runs-on: ubuntu-20.04
steps:
- name: extract version
if: startsWith(github.ref, 'refs/tags/php')
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/php}" >> $GITHUB_ENV
echo $RELEASE_VERSION
- name: checkout
uses: actions/checkout@v3

- name: publish on site repo
if: startsWith(github.ref, 'refs/tags/php')
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
working-directory: php/src/vaas
run: |
git config --global user.email "[email protected]"
git config --global user.name "Version Bot"
sed -i "s/\"version\": \"0.0.0\"/\"version\": \"$RELEASE_VERSION\"/g" ./composer.json
cp ../../../Readme.md .
git init
git add .
git commit -m"publish php $RELEASE_VERSION"
git branch -M main
git tag v$RELEASE_VERSION
git remote add origin https://ata-no-one:[email protected]/GDATASoftwareAG/vaas-php
git push origin main --tags --force
- name: sync packagist
if: startsWith(github.ref, 'refs/tags/php')
env:
PACKAGIST_API_TOKEN: ${{ secrets.PACKAGIST_API_TOKEN }}
run: curl -XPOST -H'content-type:application/json' "https://packagist.org/api/update-package?username=gdatacyberdefense&apiToken=$PACKAGIST_API_TOKEN" -d'{"repository":{"url":"https://packagist.org/packages/gdata/vaas"}}'

- name: Microsoft Teams Notification
uses: skitionek/notify-microsoft-teams@master
if: failure()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
overwrite: "{title: `Failed workflow on for VaaS-SDK ${workflow}`, sections: [{activityTitle: 'build failed', activitySubtitle: `Failed workflow on for VaaS-SDK ${workflow}`, activityImage: 'https://adaptivecards.io/content/cats/3.png'}], themeColor: '#ff0000'}"
37 changes: 0 additions & 37 deletions .github/workflows/ci-php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,43 +84,6 @@ jobs:
run: php GetVerdictByHash.php
working-directory: php/examples/VaasExample

deploy:
name: Deploy new php version
runs-on: ubuntu-20.04
steps:
- name: extract version
if: startsWith(github.ref, 'refs/tags/php')
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/php}" >> $GITHUB_ENV
echo $RELEASE_VERSION
- name: checkout
uses: actions/checkout@v3

- name: publish on site repo
if: startsWith(github.ref, 'refs/tags/php')
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
working-directory: php/src/vaas
run: |
git config --global user.email "[email protected]"
git config --global user.name "Version Bot"
sed -i "s/\"version\": \"0.0.0\"/\"version\": \"$RELEASE_VERSION\"/g" ./composer.json
cp ../../../Readme.md .
git init
git add .
git commit -m"publish php $RELEASE_VERSION"
git branch -M main
git tag v$RELEASE_VERSION
git remote add origin https://ata-no-one:[email protected]/GDATASoftwareAG/vaas-php
git push origin main --tags --force
- name: sync packagist
if: startsWith(github.ref, 'refs/tags/php')
env:
PACKAGIST_API_TOKEN: ${{ secrets.PACKAGIST_API_TOKEN }}
run: curl -XPOST -H'content-type:application/json' "https://packagist.org/api/update-package?username=gdatacyberdefense&apiToken=$PACKAGIST_API_TOKEN" -d'{"repository":{"url":"https://packagist.org/packages/gdata/vaas"}}'

- name: Microsoft Teams Notification
uses: skitionek/notify-microsoft-teams@master
if: failure()
Expand Down

0 comments on commit 1e14410

Please sign in to comment.