Skip to content

Commit 80f0604

Browse files
ci: generate zip package and version file, add docker deployment (#687)
1 parent 8fe52bd commit 80f0604

File tree

14 files changed

+110
-19
lines changed

14 files changed

+110
-19
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,40 @@ jobs:
2222
- name: Setup Gradle
2323
uses: gradle/gradle-build-action@v2
2424

25-
- name: Download the latest zip
26-
uses: carlosperate/download-file-action@v2
27-
with:
28-
file-url: 'https://downloads.crowdin.com/cli/v3/crowdin-cli.zip'
29-
3025
- name: Generate autocomplete script
3126
run: |
3227
./gradlew shadowJar
3328
cd build/libs
3429
java -cp crowdin-cli-*.jar picocli.AutoComplete com.crowdin.cli.commands.picocli.RootCommand
3530
31+
- name: Build zip package
32+
run: |
33+
mkdir crowdin-cli
34+
cp build/libs/crowdin-cli-*.jar crowdin-cli/crowdin-cli.jar
35+
cp build/libs/crowdin_completion crowdin-cli/crowdin_completion
36+
cp packages/zip/* crowdin-cli/
37+
zip -r crowdin-cli.zip crowdin-cli && chmod 0644 crowdin-cli.zip
38+
rm -rf crowdin-cli
39+
3640
- name: Generate shasum
3741
id: shasum
3842
run: |
3943
echo hash=$(shasum -a 256 crowdin-cli.zip | cut -f 1 -d " ") >> $GITHUB_OUTPUT
4044
touch crowdin-cli_checksum.sha256
4145
shasum -a 256 crowdin-cli.zip > crowdin-cli_checksum.sha256
4246
47+
- name: Generate version.txt file
48+
run: |
49+
echo ${{ github.ref_name }} > version.txt
50+
4351
- name: Upload asset
4452
uses: softprops/action-gh-release@v1
4553
with:
4654
files: |
4755
crowdin-cli.zip
4856
crowdin-cli_checksum.sha256
4957
build/libs/crowdin_completion
58+
version.txt
5059
5160
npm:
5261
runs-on: ubuntu-latest
@@ -106,7 +115,7 @@ jobs:
106115
uses: KSXGitHub/github-actions-deploy-aur@v2.6.0
107116
with:
108117
pkgname: crowdin-cli
109-
pkgbuild: ./pkgbuild/PKGBUILD
118+
pkgbuild: ./packages/aur/pkgbuild/PKGBUILD
110119
commit_username: ${{ secrets.AUR_USERNAME }}
111120
commit_email: ${{ secrets.AUR_EMAIL }}
112121
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
@@ -136,15 +145,32 @@ jobs:
136145
- name: Update checksum
137146
run: |
138147
echo "New Hash: ${{ needs.assets.outputs.checksum }}\n"
139-
sed -i "s/checksum = '.*'/checksum = '${{ needs.assets.outputs.checksum }}'/g" chocolatey/tools/chocolateyinstall.ps1
140-
cat chocolatey/tools/chocolateyinstall.ps1
148+
sed -i "s/checksum = '.*'/checksum = '${{ needs.assets.outputs.checksum }}'/g" packages/chocolatey/tools/chocolateyinstall.ps1
149+
cat packages/chocolatey/tools/chocolateyinstall.ps1
141150
142151
- name: Choco pack
143152
uses: crazy-max/ghaction-chocolatey@v2
144153
with:
145-
args: pack chocolatey/crowdin-cli.nuspec
154+
args: pack packages/chocolatey/crowdin-cli.nuspec
146155

147156
- name: Choco publish
148157
uses: crazy-max/ghaction-chocolatey@v2
149158
with:
150159
args: push --api-key ${{ secrets.CHOCOLATEY_API_KEY }} --source=https://push.chocolatey.org/
160+
161+
docker:
162+
runs-on: ubuntu-latest
163+
needs: assets
164+
steps:
165+
- uses: actions/checkout@v3
166+
167+
- name: Copy Dockerfile
168+
run: |
169+
cp packages/docker/Dockerfile Dockerfile
170+
171+
- name: Build Docker image
172+
run: |
173+
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" docker.io
174+
docker build --pull -t "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:${{ github.ref_name }}" -t "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:latest" .
175+
docker push "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:${{ github.ref_name }}"
176+
docker push "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:latest"
File renamed without changes.

chocolatey/tools/chocolateyinstall.ps1 renamed to packages/chocolatey/tools/chocolateyinstall.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ $packageVersion = $env:ChocolateyPackageVersion
66
$packageArgs = @{
77
packageName = $packageName
88
unzipLocation = $toolsDir
9-
url = 'https://downloads.crowdin.com/cli/v3/crowdin-cli.zip'
9+
url = 'https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip'
1010
checksum = '9078bcacbb481eb01fbbfaf6bef87322bb1ca8d6835b543517e913127e0089c4'
1111
checksumType = 'sha256'
1212
}

packages/docker/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM alpine
2+
3+
RUN apk --no-cache add sudo openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community;
4+
5+
ADD https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip /usr/
6+
7+
RUN unzip -j /usr/crowdin-cli.zip; \
8+
sh install-crowdin-cli.sh; \
9+
rm /usr/crowdin-cli.zip; \
10+
rm *.*;
11+
12+
RUN echo -e '#!/bin/sh\njava -jar /usr/local/bin/crowdin-cli.jar "$@"' > /usr/local/bin/crowdin; \
13+
chmod +x /usr/local/bin/crowdin;
14+
15+
WORKDIR /usr/crowdin-project
16+
17+
CMD ["sh"]

packages/zip/README.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
------------------------------ Crowdin CLI v3 ---------------------------------
2+
3+
# Installation on Linux and MacOS
4+
5+
Run `. install-crowdin-cli.sh` in the terminal with sudo rights in order to add `crowdin` command to your terminal
6+
7+
-------------------------------------------------------------------------------
8+
9+
# Installation on Windows
10+
11+
1. Open Command Prompt as an Administrator
12+
- Click Start
13+
- In the Start Search box, type `cmd`, and then press CTRL+SHIFT+ENTER
14+
- If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue
15+
16+
2. Run `setup-crowdin.bat` script in order to add `crowdin` command to the Command Prompt
17+
3. Restart your Command Prompt
18+
19+
-------------------------------------------------------------------------------
20+
21+
# Running the App
22+
23+
Use the following method to run the app:
24+
25+
- crowdin
26+
27+
Alternative method:
28+
29+
- java -jar crowdin-cli.jar
30+
31+
-------------------------------------------------------------------------------
32+
33+
# General Commands
34+
35+
To display help information:
36+
37+
- crowdin -h
38+
39+
To generate Crowdin CLI configuration skeleton:
40+
41+
- crowdin init
42+
43+
To analyze your configuration file for potential errors:
44+
45+
- crowdin lint
46+
47+
To show a list of source files in the current project:
48+
49+
- crowdin list project
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

release.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ module.exports = {
6868
},
6969
{
7070
"files": [
71-
"pkgbuild/PKGBUILD"
71+
"packages/aur/pkgbuild/PKGBUILD"
7272
],
7373
"from": "pkgver=.*",
7474
"to": "pkgver=${nextRelease.version}",
7575
"results": [
7676
{
77-
"file": "pkgbuild/PKGBUILD",
77+
"file": "packages/aur/pkgbuild/PKGBUILD",
7878
"hasChanged": true,
7979
"numMatches": 1,
8080
"numReplacements": 1
@@ -84,13 +84,13 @@ module.exports = {
8484
},
8585
{
8686
"files": [
87-
"chocolatey/crowdin-cli.nuspec"
87+
"packages/chocolatey/crowdin-cli.nuspec"
8888
],
8989
"from": "<version>.*</version>",
9090
"to": "<version>${nextRelease.version}</version>",
9191
"results": [
9292
{
93-
"file": "chocolatey/crowdin-cli.nuspec",
93+
"file": "packages/chocolatey/crowdin-cli.nuspec",
9494
"hasChanged": true,
9595
"numMatches": 1,
9696
"numReplacements": 1
@@ -115,8 +115,8 @@ module.exports = {
115115
"src/main/resources/crowdin.properties",
116116
"package.json",
117117
"package-lock.json",
118-
"pkgbuild/PKGBUILD",
119-
"chocolatey/*",
118+
"packages/aur/pkgbuild/PKGBUILD",
119+
"packages/chocolatey/*",
120120
"CHANGELOG.md"
121121
],
122122
"message": "chore(release): version ${nextRelease.version} [skip ci]"

src/main/resources/crowdin.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
application.name=crowdin-cli
22
application.version=3.15.0
33
application.base_url=https://api.crowdin.com
4-
application.user_agent=crowdin-java-cli
5-
application.version_file_url=https://downloads.crowdin.com/cli/v3/version.txt
4+
application.version_file_url=https://github.com/crowdin/crowdin-cli/releases/latest/download/version.txt

website/docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ docker pull crowdin/cli
120120

121121
## Standalone version
122122

123-
Crowdin CLI can be installed as a stand-alone Java application. [Download for macOS, Linux and Windows](https://downloads.crowdin.com/cli/v3/crowdin-cli.zip)
123+
Crowdin CLI can be installed as a stand-alone Java application. [Download](https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip).
124124

125125
### Installation on Linux and macOS
126126

0 commit comments

Comments
 (0)