Automatic release new version on tag workflow
Managing an open source project really takes a lot of efforts. There are many repeated tasks which wastes your time everywhere: Testing, Building, Releasing, ... and sometimes, you'd also want to update your followers with the new released version.
Fortunately, Github actions & workflows came to rescue! With tons of available actions, we can automate many repeated & boring tasks, and keep our time to focus on code.
Today I'd like to share with you a GitHub worklow to build and release your application into a Github release, then notify your followers about this new release.
With this worklow, we automate all the testing, building steps and releasing steps, everytime you push a new release tag (example: v0.0.1, v0.0.2,...). Then send a new message about the newly released version to a Telegram channel.
Submission Category: DIY Deployments
Yaml File or Link to Code
ActionsHackathon21 / release-on-tag
Release a new version on very tag, then notify your followers on social networks
Release new version on tag
Bonus: Also notify your followers on every update!
This project follows the DEV.to #ActionsHackathon21 hackathon.
Use GitHub Actions and Workflows to build and release your application on every release tag.
Then send an announcement to your Telegram channel about the new release
Check the complete workflow here (release-on-tag.yml)
Actions used
- actions/checkout@v2 To checkout the source code from the repository
- actions/cache@v2 To cache the dependencies, allow us to re use them for future builds
- marvinpinto/action-automatic-releases@latest To release your build to Github Release page
(Also actions/setup-node@v2 for setup nodejs, although it's not required)
Configurations
- You can config the release tag prefix, with
on.push.tags
key. - To send announcement to Telegram, you need to configure the workflow using following steps
- Talk with Telegram's @BotFather to create a new bot if you don't have one. We will use this bot to send messages to the Telegram channel. Heβ¦
- README: https://github.com/ActionsHackathon21/release-on-tag/blob/main/README.md
- Workflow file: https://github.com/ActionsHackathon21/release-on-tag/blob/main/.github/workflows/release-on-tag.yml
- License: https://github.com/ActionsHackathon21/release-on-tag/blob/main/COPYING
In the repository, there is a sample NextJS project, however you can change a bit on the workflow file to match your project.
Configurations
- You can config the release tag prefix, with
on.push.tags
key. - To send announcement to Telegram, you need to configure the workflow using following steps:
- Talk with Telegram's @BotFather to create a new bot if you don't have one. We will use this bot to send messages to the Telegram channel. He will give you the token access the HTTP API.
- On your Telegram channel, grant admin permissions to the bot.
- Set the
TELEGRAM_CHANNEL
variable. - Add the
TELEGRAM_BOT_TOKEN
secret (using the token access above) into your repository secret (Settings > Secrets > New repository secret)
Pre-release
There is also a pre-release workflow (prerelease-on-push.yml), which will build and create a pre-release version of your application, on every push to main
branch.
Top comments (0)