diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8f7aaf --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +tags diff --git a/README.md b/README.md new file mode 100644 index 0000000..d7fe454 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +## Github Action for Transifex CLI + +> [Transifex CLI homepage](https://github.com/transifex/cli) + +Integrate the Transifex CLI within a Github action. Usage: + +1. Make sure your repository has a Transifex CLI configuration. If not, set it + up with: + + ```sh + tx init + tx add # Complete the interactive wizard + git add .tx + git commit -m "Add Transifex CLI configuration" + ``` + +2. Add a Transifex API token to your repository as a repository secret + +3. Use this in your Github action workflow: + + ```yaml + on: [push] + jobs: + Push-source-file: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Push source file using transifex client + uses: transifex/cli-action@v1 + with: + token: ${{ secrets.TX_TOKEN }} + ``` + +### Action options + +**`token` (required)**: The Transifex API token to use for pushing + +**`version` (default: latest)**: The Transifex CLI version to use + +**`args` (default: push)**: Which arguments to pass to the tx command. By +default, the CLI will push the source files of all resources configured in +`.tx/config`. diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..f9b5e8c --- /dev/null +++ b/action.yaml @@ -0,0 +1,30 @@ +name: Transifex CLI action +description: Invoke the Transifex CLI as part of a Github action +branding: + icon: globe + color: blue +inputs: + version: + description: The version of the Transifex CLI to use + required: true + default: 'latest' + args: + description: What arguments to pass to the CLI + required: true + default: 'push' + token: + description: Transifex API token to use + required: true +runs: + using: 'composite' + steps: + - name: Create temporary directory to store the CLI + run: mkdir /tmp/tx + shell: bash + - name: Download the CLI + run: curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash -s -- ${{ inputs.version }} + working-directory: /tmp/tx + shell: bash + - name: Invoke the CLI with the provided token and arguments + run: /tmp/tx/tx --token ${{ inputs.token }} ${{ inputs.args }} + shell: bash