https://github.com/mbaraa/rex-action
Rex's action
https://github.com/mbaraa/rex-action
deployment github-actions
Last synced: 3 months ago
JSON representation
Rex's action
- Host: GitHub
- URL: https://github.com/mbaraa/rex-action
- Owner: mbaraa
- License: gpl-3.0
- Created: 2023-05-04T15:49:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-20T19:52:40.000Z (over 1 year ago)
- Last Synced: 2026-02-11T05:19:14.482Z (4 months ago)
- Topics: deployment, github-actions
- Language: JavaScript
- Homepage:
- Size: 3.03 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rex
Redeploy docker compose containers after git push
### Installing the server:
This will install Rex's server which will allow deploying your app
1. You can use the latest binary release in the [releases](https://github.com/mbaraa/rex/releases)
2. Or if that doesn't work, compile it yourself using
- `go build -ldflags="-w -s"`
3. Create a `.env` file by copying the example
- `cp .env.example .env` if you run windows on your server I have nothing to say to you, except WHY!!
4. Modify the fields as you like, make sure to not share your token, since you'll use it in the action to deploy the repo, and it being public is not good news :)
5. Install the systemd service, since I haven't figured out how to make this fully work in docker :(
# /etc/systemd/system/rex.service
[Unit]
Description=Rex
[Service]
Type=simple
User=yourusername # so that git will work, and the other docker stuff
WorkingDirectory=/path/to/rex/binary/and/env/file # they must be in the same directory, otherwise it won't work :)
ExecStart=/path/to/rex/binary
Restart=always
[Install]
WantedBy=multi-user.target
6\. Reload systemd's daemons and start the server
```bash
sudo systemctl daemon-reload
sudo systemctl enable --now rex
```
### Adding the GitHub action
This where the fun begins.
1. Add a [secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets) to your GitHub Repo called `REX_KEY` with the same value that you've set on the server
- You can add the server url as a secret as well if you prefer to :)
2. Create the GitHub action under `.github/workflows/rex-build.yml`
```yaml
jobs:
rex-deploy:
runs-on: ubuntu-latest
steps:
- name: rex-7567-e27
uses: mbaraa/rex-action@v1.6.4
with:
server-url: example.com
token: ${{ secrets.REX_KEY }}
repo-name: repoName
# commit-sha is optional :)
commit-sha: ${{ github.sha }}
# latest-tag is optional :)
latest-tag: ${{ github.ref }}
# compose-file-name is optional :)
compose-file-name: "docker-compose-prod.yml"
```
3. Do a push and see the magic happen
### Note:
This action was generated using [this](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action) doc.