github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/.github/workflows/build.yml (about) 1 name: API CLients 2 on: 3 push: 4 branches: 5 - master 6 jobs: 7 build-go: 8 runs-on: ubuntu-latest 9 steps: 10 - name: Checkout 🛎️ 11 uses: actions/checkout@v3 12 with: 13 persist-credentials: false 14 - 15 name: Set up Go 16 uses: actions/setup-go@v2 17 with: 18 go-version: 1.19.6 19 - name: Build and Deploy 🚀 20 env: 21 API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 22 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 23 run: | 24 npm install 25 npm run generate.go 26 git clone https://$API_TOKEN_GITHUB@github.com/phrase/phrase-go.git clones/go &> /dev/null 27 rsync -avI --delete --exclude='.git/' clients/go/ clones/go 28 cd clones/go 29 git status --verbose 30 if [ -n "$(git status --porcelain)" ]; then 31 git config --global user.email "support@phrase.com" 32 git config --global user.name "Phrase" 33 git add . 34 git commit --message "Deploying from phrase/openapi@${GITHUB_SHA::8}" 35 PACKAGE_VERSION=$(awk '/- Package version:/{print $NF}' README.md) 36 git tag -a v$PACKAGE_VERSION -m v$PACKAGE_VERSION || true 37 git push --tags origin master 38 else 39 echo " No changes, skipping." 40 fi 41 42 build-cli: 43 runs-on: ubuntu-latest 44 steps: 45 - name: Checkout 🛎️ 46 uses: actions/checkout@v3 47 with: 48 persist-credentials: false 49 - 50 name: Set up Go 51 uses: actions/setup-go@v2 52 with: 53 go-version: 1.19.6 54 - name: Build and Deploy 🚀 55 env: 56 API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 57 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 58 run: | 59 npm install 60 npm run generate.cli 61 git clone https://$API_TOKEN_GITHUB@github.com/phrase/phrase-cli.git clones/cli &> /dev/null 62 rsync -avI --delete --exclude='.git/' clients/cli/ clones/cli 63 cd clones/cli 64 git status --verbose 65 if [ -n "$(git status --porcelain)" ]; then 66 git config --global user.email "support@phrase.com" 67 git config --global user.name "Phrase" 68 git add . 69 git commit --message "Deploying from phrase/openapi@${GITHUB_SHA::8}" 70 PACKAGE_VERSION=$(awk '/- Package version:/{print $NF}' README.md) 71 git tag -a $PACKAGE_VERSION -m $PACKAGE_VERSION || true 72 git push --tags origin master 73 else 74 echo " No changes, skipping." 75 fi 76 77 build-ruby: 78 runs-on: ubuntu-latest 79 steps: 80 - name: Checkout 🛎️ 81 uses: actions/checkout@v3 82 with: 83 persist-credentials: false 84 85 - name: Build and Deploy 🚀 86 env: 87 API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 88 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 89 run: | 90 npm install 91 npm run generate.ruby 92 git clone https://$API_TOKEN_GITHUB@github.com/phrase/phrase-ruby.git clones/ruby &> /dev/null 93 rsync -avI --delete --exclude='.git/' clients/ruby/ clones/ruby 94 cd clones/ruby 95 git status --verbose 96 if [ -n "$(git status --porcelain)" ]; then 97 git config --global user.email "support@phrase.com" 98 git config --global user.name "Phrase" 99 git add . 100 git commit --message "Deploying from phrase/openapi@${GITHUB_SHA::8}" 101 PACKAGE_VERSION=$(awk '/- Package version:/{print $NF}' README.md) 102 git tag -a $PACKAGE_VERSION -m $PACKAGE_VERSION || true 103 git push --tags origin master 104 else 105 echo " No changes, skipping." 106 fi 107 108 build-typescript: 109 runs-on: ubuntu-latest 110 steps: 111 - name: Checkout 🛎️ 112 uses: actions/checkout@v3 113 with: 114 persist-credentials: false 115 116 - name: Build and Deploy 🚀 117 env: 118 API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 119 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 120 run: | 121 npm install 122 npm run generate.typescript 123 git clone https://$API_TOKEN_GITHUB@github.com/phrase/phrase-js.git clones/typescript &> /dev/null 124 rsync -avI --delete --exclude='.git/' clients/typescript/ clones/typescript 125 cd clones/typescript 126 git status --verbose 127 if [ -n "$(git status --porcelain)" ]; then 128 git config --global user.email "support@phrase.com" 129 git config --global user.name "Phrase" 130 git add . 131 git commit --message "Deploying from phrase/openapi@${GITHUB_SHA::8}" 132 PACKAGE_VERSION=$(awk '/- Package version:/{print $NF}' README.md) 133 git tag -a $PACKAGE_VERSION -m $PACKAGE_VERSION || true 134 git push --tags origin master 135 else 136 echo " No changes, skipping." 137 fi 138 139 build-python: 140 runs-on: ubuntu-latest 141 steps: 142 - name: Checkout 🛎️ 143 uses: actions/checkout@v3 144 with: 145 persist-credentials: false 146 147 - name: Build and Deploy 🚀 148 env: 149 API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 150 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 151 run: | 152 npm install 153 npm run generate.python 154 git clone https://$API_TOKEN_GITHUB@github.com/phrase/phrase-python.git clones/python &> /dev/null 155 rsync -avI --delete --exclude='.git/' clients/python/ clones/python 156 cd clones/python 157 git status --verbose 158 if [ -n "$(git status --porcelain)" ]; then 159 git config --global user.email "support@phrase.com" 160 git config --global user.name "Phrase" 161 git add . 162 git commit --message "Deploying from phrase/openapi@${GITHUB_SHA::8}" 163 PACKAGE_VERSION=$(awk '/- Package version:/{print $NF}' README.md) 164 git tag -a $PACKAGE_VERSION -m $PACKAGE_VERSION || true 165 git push --tags origin master 166 else 167 echo " No changes, skipping." 168 fi 169 170 build-java: 171 runs-on: ubuntu-latest 172 steps: 173 - name: Checkout 🛎️ 174 uses: actions/checkout@v3 175 with: 176 persist-credentials: false 177 178 - name: Build and Deploy 🚀 179 env: 180 API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 181 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 182 run: | 183 npm install 184 npm run generate.java 185 git clone https://$API_TOKEN_GITHUB@github.com/phrase/phrase-java.git clones/java &> /dev/null 186 rsync -avI --delete --exclude='.git/' clients/java/ clones/java 187 cd clones/java 188 git status --verbose 189 if [ -n "$(git status --porcelain)" ]; then 190 git config --global user.email "support@phrase.com" 191 git config --global user.name "Phrase" 192 git add . 193 git commit --message "Deploying from phrase/openapi@${GITHUB_SHA::8}" 194 PACKAGE_VERSION=$(awk '/- Package version:/{print $NF}' README.md) 195 git tag -a $PACKAGE_VERSION -m $PACKAGE_VERSION || true 196 git push --tags origin master 197 else 198 echo " No changes, skipping." 199 fi 200 201 build-php: 202 runs-on: ubuntu-latest 203 steps: 204 - name: Checkout 🛎️ 205 uses: actions/checkout@v3 206 with: 207 persist-credentials: false 208 209 - name: Build and Deploy 🚀 210 env: 211 API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} 212 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 213 run: | 214 npm install 215 npm run generate.php 216 git clone https://$API_TOKEN_GITHUB@github.com/phrase/phrase-php.git clones/php &> /dev/null 217 rsync -avI --delete --exclude='.git/' clients/php/ clones/php 218 cd clones/php 219 git status --verbose 220 if [ -n "$(git status --porcelain)" ]; then 221 git config --global user.email "support@phrase.com" 222 git config --global user.name "Phrase" 223 git add . 224 git commit --message "Deploying from phrase/openapi@${GITHUB_SHA::8}" 225 PACKAGE_VERSION=$(awk '/- Package version:/{print $NF}' README.md) 226 git tag -a $PACKAGE_VERSION -m $PACKAGE_VERSION || true 227 git push --tags origin master 228 else 229 echo " No changes, skipping." 230 fi