1- name : Auto Build TailwindCSS Image
1+ name : Auto Release
22
33on :
44 schedule :
1010 runs-on : ubuntu-latest
1111
1212 permissions :
13- contents : read
13+ contents : write
1414 packages : write
1515 attestations : write
1616 id-token : write
2626
2727 - name : Check out code
2828 uses : actions/checkout@v4
29+ with :
30+ fetch-depth : 0 # fetch all tags for release checking
2931
3032 - name : Login to GHCR
3133 uses : docker/login-action@v3
@@ -40,17 +42,32 @@ jobs:
4042 with :
4143 repository : tailwindlabs/tailwindcss
4244
43- - name : Strip leading “v” from version
45+ - name : Strip leading "v" from version
4446 id : strip-v
4547 run : |
4648 # grab the raw output (e.g. "v4.1.7")
4749 vtag="${{ steps.get-latest-release.outputs.release }}"
48- # remove one leading “v”
50+ # remove one leading "v"
4951 clean_vtag="${vtag#v}"
5052 # expose it as an output
5153 echo "version_no_v=${clean_vtag}" >> $GITHUB_OUTPUT
54+ echo "full_version=${vtag}" >> $GITHUB_OUTPUT
55+
56+ - name : Check if release already exists
57+ id : check-release
58+ run : |
59+ # Check if we already have a release for this version
60+ version="${{ steps.strip-v.outputs.full_version }}"
61+ if git tag -l | grep -q "^${version}$"; then
62+ echo "exists=true" >> $GITHUB_OUTPUT
63+ echo "Release ${version} already exists, skipping build"
64+ else
65+ echo "exists=false" >> $GITHUB_OUTPUT
66+ echo "Release ${version} does not exist, will build and create"
67+ fi
5268
5369 - name : Build & push multi-arch
70+ if : steps.check-release.outputs.exists == 'false' # Only build if new version
5471 uses : docker/build-push-action@v4
5572 with :
5673 context : .
6279 ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }}
6380 build-args : |
6481 TAILWINDCSS_VERSION=${{ steps.strip-v.outputs.version_no_v }}
82+
83+ - name : Create and push tag
84+ if : steps.check-release.outputs.exists == 'false'
85+ run : |
86+ version="${{ steps.strip-v.outputs.full_version }}"
87+ git config user.name "github-actions[bot]"
88+ git config user.email "github-actions[bot]@users.noreply.github.com"
89+ git tag -a "${version}" -m "Auto-release for TailwindCSS ${version}"
90+ git push origin "${version}"
91+
92+ - name : Create GitHub Release
93+ if : steps.check-release.outputs.exists == 'false'
94+ uses : softprops/action-gh-release@v1
95+ with :
96+ tag_name : ${{ steps.strip-v.outputs.full_version }}
97+ name : ${{ steps.strip-v.outputs.full_version }}
98+ body : |
99+ Automatic release for TailwindCSS ${{ steps.strip-v.outputs.full_version }}
100+
101+ 1. Create `input.css` in your project:
102+ ```css
103+ @import 'tailwindcss';
104+ ```
105+
106+ 2. Create `docker-compose.yml` in your project:
107+ ```yaml
108+ services:
109+ tailwindcss:
110+ image: ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }}
111+ tty: true # Required for watch mode
112+ volumes:
113+ - .:/app
114+ command: -i ./input.css -o ./output.css --watch
115+ ```
116+
117+ 3. Or run `docker run` command (note the `-t` flag is required for watch mode):
118+ ```bash
119+ docker run -t -v "$(pwd)":/app \
120+ ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }} -i ./input.css -o ./output.css --watch
121+ ```
122+
123+ Container available at [ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }}](https://ghcr.io/scriptogre/tailwindcss:${{ steps.strip-v.outputs.version_no_v }})
124+ draft : false
125+ prerelease : false
126+ env :
127+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments