Release 11.0.0.17725
[platform/core/csapi/tizenfx.git] / .github / workflows / deploy-packages.yml
1 name: "Deploy Packages"
2
3 on:
4   workflow_dispatch:
5     inputs:
6       target:
7         description: 'Branch to deploy'
8         required: true
9         default: 'master'
10       deploy_to_myget:
11         description: 'Deploy packages to MyGet?'
12         required: true
13         default: true
14       deploy_to_tizen:
15         description: 'Submit changes to Tizen?'
16         required: true
17         default: true
18
19 env:
20   TARGET_BRANCH: ${{ github.event.inputs.target }}
21
22 jobs:
23   deploy:
24     runs-on: ubuntu-20.04
25     steps:
26     - uses: actions/checkout@v2
27       with:
28         ref: ${{ env.TARGET_BRANCH }}
29         fetch-depth: 0
30     
31     - uses: actions/setup-dotnet@v1
32       with:
33         dotnet-version: '6.0.102'
34
35     - name: Git Config
36       run: |
37         git config --global user.name "TizenAPI-Bot"
38         git config --global user.email "tizenapi@samsung.com"
39         git config core.sshCommand "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
40
41     - name: Get Branch Metadata
42       id: metadata
43       uses: TizenAPI/tizenfx-build-actions/branch-metadata@master
44       with:
45         ref: ${{ env.TARGET_BRANCH }}
46
47     - name: Get Version
48       id: version
49       env:
50         VERSION_PREFIX: ${{ steps.metadata.outputs.version-prefix }}
51       run: |
52         VERSION=$VERSION_PREFIX.$((10000+$(git rev-list --count HEAD)))
53         echo VERSION=$VERSION
54         echo "::set-output name=version::$VERSION"
55
56     - name: Build
57       env:
58         VERSION: ${{ steps.version.outputs.version }}
59       run: |
60         ./build.sh full
61         ./build.sh pack $VERSION
62
63     - name: Tag Version
64       env:
65         VERSION: ${{ steps.version.outputs.version }}
66       run: |
67         git tag -fa "v$VERSION" -m "Release $VERSION"
68         git push -f --tags origin refs/tags/"v$VERSION"
69
70     - name: Deploy NuGet packages to MyGet
71       if: github.event.inputs.deploy_to_myget == 'true'
72       env:
73         NUGET_SOURCE: https://tizen.myget.org/F/dotnet/api/v2/package
74         APIKEY: ${{ secrets.MYGET_APIKEY }}
75       run: |
76         dotnet nuget push Artifacts/*.nupkg -k $APIKEY -s $NUGET_SOURCE -t 3000
77
78     - name: Setup SSH private keys
79       uses: webfactory/ssh-agent@v0.7.0
80       with:
81         ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
82
83     - name: Submit changes to Tizen
84       if: github.event.inputs.deploy_to_tizen == 'true'
85       env:
86         VERSION: ${{ steps.version.outputs.version }}
87         GERRIT_BRANCH: ${{ steps.metadata.outputs.tizen-branch }}
88         GERRIT_URL: ssh://dotnetbuild@review.tizen.org:29418/platform/core/csapi/tizenfx
89       run: |
90         if [ -z "$GERRIT_BRANCH" ]; then
91           echo "## no specified tizen branch"
92           exit 0
93         fi
94         git remote add gerrit $GERRIT_URL
95         git fetch gerrit $GERRIT_BRANCH
96         git checkout -t gerrit/$GERRIT_BRANCH
97         git merge --no-edit -s recursive -X theirs origin/$TARGET_BRANCH
98         ./packaging/makespec.sh -r $VERSION -n $VERSION -i $VERSION
99         git add packaging/
100         if [ $(git diff --cached --numstat | wc -l) -eq 0 ]; then
101           echo "## no changes to sync"
102           exit 0
103         fi
104         SUBMIT_TAG=submit/$GERRIT_BRANCH/$(date '+%Y%m%d.%H%M%S')
105         echo SUBMIT_TAG=$SUBMIT_TAG
106         git commit -m "Release $VERSION"
107         git tag -m "Release $VERSION" $SUBMIT_TAG
108         git push -f gerrit HEAD:$GERRIT_BRANCH
109         git push gerrit refs/tags/$SUBMIT_TAG
110         echo "::notice title=Submit Request TAG::$SUBMIT_TAG"