Localazy Release Tags management with GitHub Actions

We already support automated uploads and downloads with GitHub Actions for some time. For a general dive-in into the basic usage of Localazy's GitHub actions, check out our previous article. Today, we're going to look at how we can take this automation one step further.

Read the article: Automated Localization: GitHub Actions ❤ Localazy

Release tags work pretty much like tags on GitHub, GitLab, or Docker. They allow you to mark the state of your Localazy app, preserving the translations and translation progress at the given time, which is super helpful, for instance, when you use different branches for production, testing, and development.

You can preserve translations for production for as long as you are working on a new release, and only once you publish it, you start using the latest translations as well.

You can read more about Release tags in the documentation.

📚 A comprehensive overview

In the lines below, you'll find a comprehensive overview of everything Localazy's Tag action can do for you. All the options are based on the capabilities of Localazy CLI.

Check out related documentation to read about every option in greater detail.

To run a GH action, you need to create a YAML file in .github/workflows in your code. Each example represents a single step of a complete custom workflow. You can skip to see the full workflow to see the whole configuration.

The following paragraphs presume you have access to Release tags through an active professional plan and you have integrated Localazy in your code (there are write and read keys in either localazy.json or localazy.keys.json)

This lists all the tags associated with your application.

      - name: List tags
        uses: localazy/[email protected]
        with:
          list: true

Publish tag

This command saves the current state of your app under a given new-tag name.

      - name: Publish new-tag
        uses: localazy/[email protected]
        with:
          publish: 'new-tag'

Replaces the target tag, new-tag-2, with the state of the new-tag.

      - name: Promote new-tag
        uses: localazy/[email protected]   
        with:
          promote_from: 'new-tag'
          promote_to: 'new-tag-2'

Rename tag

Simply renames the target tag.

      - name: Rename new-tag
        uses: localazy/[email protected]   
        with:
          rename_from: 'new-tag'
          rename_to: 'renamed-tag'

Merging tags allows you to apply translations from the source tag to the target tag. The result of the operation is stored as the output tag. Several optional parameters alter what kind of changes are applied.

Check out the documentation for a complete overview.

In this example, we merge state of the renamed-tag into new-tag-2 and save the output under a new merged-tag. On top of that, we added a single parameter --add-languages which adds any missing language to the target tag if the source tag contains any additional languages.

      - name: Merge tag
        uses: localazy/[email protected]   
        with:
          merge_from: 'renamed-tag'
          merge_to: 'new-tag-2'
          merge_output: 'merged-tag'
          merge_parameters: '--add-languages'

Delete tag

Lastly, this command deletes an existing tag.

      - name: Delete renamed-tag
        uses: localazy/[email protected]   
        with:
          delete: 'renamed-tag'

🗃️ Full workflow

When this workflow successfully finishes, it will leave your app in the same state as before since the config will delete all the newly created tags at the end. Feel free to create a new testing project and try it out.

### .github/workflows/locales.yml
on: [push]
jobs:
  release_tags:
    runs-on: ubuntu-latest
    name: Complex overview of tags management
    steps:
      - uses: actions/[email protected]
      - name: List tags
        uses: localazy/[email protected]
        with:
          list: true
      - name: Publish new-tag
        uses: localazy/[email protected]
        with:
          publish: 'new-tag'
      - name: Publish new-tag-2
        uses: localazy/[email protected]   
        with:
          publish: 'new-tag-2'
      - name: Promote new-tag
        uses: localazy/[email protected]   
        with:
          promote_from: 'new-tag'
          promote_to: 'new-tag-2'
      - name: Rename new-tag
        uses: localazy/[email protected]   Q
        with:
          rename_from: 'new-tag'
          rename_to: 'renamed-tag'
      - name: Merge tag
        uses: localazy/[email protected]   
        with:
          merge_from: 'renamed-tag'
          merge_to: 'new-tag-2'
          merge_output: 'merged-tag'
          merge_parameters: '--add-languages'
      - name: Delete renamed-tag
        uses: localazy/[email protected]   
        with:
          delete: 'renamed-tag'
      - name: Delete merged-tag
        uses: localazy/[email protected]   
        with:
          delete: 'merged-tag'
      - name: Delete new-tag-2
        uses: localazy/[email protected]   
        with:
          delete: 'new-tag-2'

✔️ Closing words

This was a comprehensive overview of what you can do with Github actions and Localazy's Release Tags. You may checkout the sample repo for reference. Happy coding!

You might also like


This is a companion discussion topic for the original entry at https://localazy.com/blog/release-tags-management-github-actions