Build and release when new tmux version is out. #655
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and release when new tmux version is out. | |
on: | |
schedule: | |
- cron: '0 10 * * *' | |
workflow_dispatch: | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: master | |
- name: Fetch release version | |
run: | | |
latest_version=$(curl -sL https://api.github.com/repos/tmux/tmux/releases/latest | jq -r ".tag_name") | |
if [[ $latest_version != "null" ]] | |
then | |
echo "$latest_version" > release-versions/tmux-latest.txt | |
fi | |
- name: Check for modified files | |
id: git-check | |
run: echo modified="$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")" >> $GITHUB_OUTPUT | |
- name: Commit latest release version | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Kiyoon Kim' | |
git config --global user.email 'kiyoon@users.noreply.github.com' | |
git commit -am "New tmux release version" | |
git push | |
- name: Build the Docker image | |
if: steps.git-check.outputs.modified == 'true' | |
id: build | |
working-directory: . | |
run: | | |
TMUX_RELEASE_TAG=$(cat release-versions/tmux-latest.txt) | |
echo "TMUX_RELEASE_TAG=$TMUX_RELEASE_TAG" >> $GITHUB_OUTPUT | |
docker build . -t tmux --build-arg TMUX_RELEASE_TAG=$TMUX_RELEASE_TAG | |
docker create -ti --name tmuxcontainer tmux bash | |
docker cp tmuxcontainer:/opt/build/tmux.appimage . | |
- name: Create Release | |
if: steps.git-check.outputs.modified == 'true' | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: True | |
tag: ${{ steps.build.outputs.TMUX_RELEASE_TAG }} | |
name: tmux ${{ steps.build.outputs.TMUX_RELEASE_TAG }} | |
prerelease: False | |
artifacts: "tmux.appimage" | |
token: ${{ secrets.GITHUB_TOKEN }} | |