Skip to content

Commit

Permalink
ci: generate zip package and version file, add docker deployment (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar authored Dec 22, 2023
1 parent 8fe52bd commit 80f0604
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 19 deletions.
44 changes: 35 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,40 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Download the latest zip
uses: carlosperate/download-file-action@v2
with:
file-url: 'https://downloads.crowdin.com/cli/v3/crowdin-cli.zip'

- name: Generate autocomplete script
run: |
./gradlew shadowJar
cd build/libs
java -cp crowdin-cli-*.jar picocli.AutoComplete com.crowdin.cli.commands.picocli.RootCommand
- name: Build zip package
run: |
mkdir crowdin-cli
cp build/libs/crowdin-cli-*.jar crowdin-cli/crowdin-cli.jar
cp build/libs/crowdin_completion crowdin-cli/crowdin_completion
cp packages/zip/* crowdin-cli/
zip -r crowdin-cli.zip crowdin-cli && chmod 0644 crowdin-cli.zip
rm -rf crowdin-cli
- name: Generate shasum
id: shasum
run: |
echo hash=$(shasum -a 256 crowdin-cli.zip | cut -f 1 -d " ") >> $GITHUB_OUTPUT
touch crowdin-cli_checksum.sha256
shasum -a 256 crowdin-cli.zip > crowdin-cli_checksum.sha256
- name: Generate version.txt file
run: |
echo ${{ github.ref_name }} > version.txt
- name: Upload asset
uses: softprops/action-gh-release@v1
with:
files: |
crowdin-cli.zip
crowdin-cli_checksum.sha256
build/libs/crowdin_completion
version.txt
npm:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -106,7 +115,7 @@ jobs:
uses: KSXGitHub/[email protected]
with:
pkgname: crowdin-cli
pkgbuild: ./pkgbuild/PKGBUILD
pkgbuild: ./packages/aur/pkgbuild/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
Expand Down Expand Up @@ -136,15 +145,32 @@ jobs:
- name: Update checksum
run: |
echo "New Hash: ${{ needs.assets.outputs.checksum }}\n"
sed -i "s/checksum = '.*'/checksum = '${{ needs.assets.outputs.checksum }}'/g" chocolatey/tools/chocolateyinstall.ps1
cat chocolatey/tools/chocolateyinstall.ps1
sed -i "s/checksum = '.*'/checksum = '${{ needs.assets.outputs.checksum }}'/g" packages/chocolatey/tools/chocolateyinstall.ps1
cat packages/chocolatey/tools/chocolateyinstall.ps1
- name: Choco pack
uses: crazy-max/ghaction-chocolatey@v2
with:
args: pack chocolatey/crowdin-cli.nuspec
args: pack packages/chocolatey/crowdin-cli.nuspec

- name: Choco publish
uses: crazy-max/ghaction-chocolatey@v2
with:
args: push --api-key ${{ secrets.CHOCOLATEY_API_KEY }} --source=https://push.chocolatey.org/

docker:
runs-on: ubuntu-latest
needs: assets
steps:
- uses: actions/checkout@v3

- name: Copy Dockerfile
run: |
cp packages/docker/Dockerfile Dockerfile
- name: Build Docker image
run: |
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" docker.io
docker build --pull -t "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:${{ github.ref_name }}" -t "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:latest" .
docker push "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:${{ github.ref_name }}"
docker push "${{ secrets.DOCKER_HUB_REGISTRY_IMAGE }}:latest"
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $packageVersion = $env:ChocolateyPackageVersion
$packageArgs = @{
packageName = $packageName
unzipLocation = $toolsDir
url = 'https://downloads.crowdin.com/cli/v3/crowdin-cli.zip'
url = 'https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip'
checksum = '9078bcacbb481eb01fbbfaf6bef87322bb1ca8d6835b543517e913127e0089c4'
checksumType = 'sha256'
}
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions packages/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine

RUN apk --no-cache add sudo openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community;

ADD https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip /usr/

RUN unzip -j /usr/crowdin-cli.zip; \
sh install-crowdin-cli.sh; \
rm /usr/crowdin-cli.zip; \
rm *.*;

RUN echo -e '#!/bin/sh\njava -jar /usr/local/bin/crowdin-cli.jar "$@"' > /usr/local/bin/crowdin; \
chmod +x /usr/local/bin/crowdin;

WORKDIR /usr/crowdin-project

CMD ["sh"]
49 changes: 49 additions & 0 deletions packages/zip/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
------------------------------ Crowdin CLI v3 ---------------------------------

# Installation on Linux and MacOS

Run `. install-crowdin-cli.sh` in the terminal with sudo rights in order to add `crowdin` command to your terminal

-------------------------------------------------------------------------------

# Installation on Windows

1. Open Command Prompt as an Administrator
- Click Start
- In the Start Search box, type `cmd`, and then press CTRL+SHIFT+ENTER
- If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue

2. Run `setup-crowdin.bat` script in order to add `crowdin` command to the Command Prompt
3. Restart your Command Prompt

-------------------------------------------------------------------------------

# Running the App

Use the following method to run the app:

- crowdin

Alternative method:

- java -jar crowdin-cli.jar

-------------------------------------------------------------------------------

# General Commands

To display help information:

- crowdin -h

To generate Crowdin CLI configuration skeleton:

- crowdin init

To analyze your configuration file for potential errors:

- crowdin lint

To show a list of source files in the current project:

- crowdin list project
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ module.exports = {
},
{
"files": [
"pkgbuild/PKGBUILD"
"packages/aur/pkgbuild/PKGBUILD"
],
"from": "pkgver=.*",
"to": "pkgver=${nextRelease.version}",
"results": [
{
"file": "pkgbuild/PKGBUILD",
"file": "packages/aur/pkgbuild/PKGBUILD",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
Expand All @@ -84,13 +84,13 @@ module.exports = {
},
{
"files": [
"chocolatey/crowdin-cli.nuspec"
"packages/chocolatey/crowdin-cli.nuspec"
],
"from": "<version>.*</version>",
"to": "<version>${nextRelease.version}</version>",
"results": [
{
"file": "chocolatey/crowdin-cli.nuspec",
"file": "packages/chocolatey/crowdin-cli.nuspec",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
Expand All @@ -115,8 +115,8 @@ module.exports = {
"src/main/resources/crowdin.properties",
"package.json",
"package-lock.json",
"pkgbuild/PKGBUILD",
"chocolatey/*",
"packages/aur/pkgbuild/PKGBUILD",
"packages/chocolatey/*",
"CHANGELOG.md"
],
"message": "chore(release): version ${nextRelease.version} [skip ci]"
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/crowdin.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
application.name=crowdin-cli
application.version=3.15.0
application.base_url=https://api.crowdin.com
application.user_agent=crowdin-java-cli
application.version_file_url=https://downloads.crowdin.com/cli/v3/version.txt
application.version_file_url=https://github.com/crowdin/crowdin-cli/releases/latest/download/version.txt
2 changes: 1 addition & 1 deletion website/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ docker pull crowdin/cli

## Standalone version

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)
Crowdin CLI can be installed as a stand-alone Java application. [Download](https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip).

### Installation on Linux and macOS

Expand Down

0 comments on commit 80f0604

Please sign in to comment.