Skip to content

Commit adc9c47

Browse files
committed
doc: update workflows config. #454
1 parent 73c14bb commit adc9c47

File tree

1 file changed

+79
-28
lines changed

1 file changed

+79
-28
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -127,39 +127,90 @@ jobs:
127127
npm-publish --token="${{ secrets.NPM_TOKEN }}" ./package.json
128128
129129
# Create Docker Image
130-
- name: Docker login
131-
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
132-
133-
- name: Build linux-command image
134-
run: |
135-
rm -rf .deploy/linux-command.docset.tgz
136-
docker image build -t linux-command .
130+
- name: Set up Docker Buildx
131+
uses: docker/setup-buildx-action@v2
132+
- name: Login to Docker Hub
133+
uses: docker/login-action@v2
134+
with:
135+
username: ${{ secrets.DOCKER_USER }}
136+
password: ${{ secrets.DOCKER_PASSWORD }}
137137

138-
- name: Tags & Push image(latest)
139-
run: |
140-
docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:latest
141-
docker push ${{ secrets.DOCKER_USER }}/linux-command:latest
138+
- name: Build and push image:latest
139+
uses: docker/build-push-action@v3
140+
with:
141+
push: true
142+
context: .
143+
platforms: linux/amd64,linux/arm64
144+
tags: ${{ secrets.DOCKER_USER }}/linux-command:latest
142145

143-
- name: Tags & Push image
146+
- name: Build and push image:tags
147+
uses: docker/build-push-action@v3
144148
if: steps.create_tag.outputs.successful
145-
run: |
146-
echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
147-
docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
148-
docker push ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
149+
with:
150+
push: true
151+
context: .
152+
platforms: linux/amd64,linux/arm64
153+
tags: ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
149154

150155
# Create Docker Image in Github
151-
- name: Login to GitHub registry
152-
run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
153-
154-
- name: Build docker image
155-
run: docker build -t ghcr.io/jaywcjlove/linux-command:latest .
156+
- name: Login to the GitHub Container Registry
157+
uses: docker/login-action@v2
158+
with:
159+
registry: ghcr.io
160+
username: ${{ github.actor }}
161+
password: ${{ secrets.GITHUB_TOKEN }}
156162

157-
- name: Publish to GitHub registry
158-
run: docker push ghcr.io/jaywcjlove/linux-command:latest
163+
- name: Build and push image:latest
164+
uses: docker/build-push-action@v3
165+
with:
166+
push: true
167+
context: .
168+
platforms: linux/amd64,linux/arm64
169+
tags: ghcr.io/jaywcjlove/linux-command:latest
159170

160-
- name: Tag docker image (beta) and publish to GitHub registry
171+
- name: Build and push image:tags
172+
uses: docker/build-push-action@v3
161173
if: steps.create_tag.outputs.successful
162-
run: |
163-
echo "version: v${{ steps.changelog.outputs.version }}"
164-
docker tag ghcr.io/jaywcjlove/linux-command:latest ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}
165-
docker push ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}
174+
with:
175+
push: true
176+
context: .
177+
platforms: linux/amd64,linux/arm64
178+
tags: ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}
179+
180+
# # Create Docker Image
181+
# - name: Docker login
182+
# run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
183+
184+
# - name: Build linux-command image
185+
# run: |
186+
# rm -rf .deploy/linux-command.docset.tgz
187+
# docker image build -t linux-command .
188+
189+
# - name: Tags & Push image(latest)
190+
# run: |
191+
# docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:latest
192+
# docker push ${{ secrets.DOCKER_USER }}/linux-command:latest
193+
194+
# - name: Tags & Push image
195+
# if: steps.create_tag.outputs.successful
196+
# run: |
197+
# echo "outputs.tag - ${{ steps.changelog.outputs.version }}"
198+
# docker tag linux-command ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
199+
# docker push ${{ secrets.DOCKER_USER }}/linux-command:${{steps.changelog.outputs.version}}
200+
201+
# # Create Docker Image in Github
202+
# - name: Login to GitHub registry
203+
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
204+
205+
# - name: Build docker image
206+
# run: docker build -t ghcr.io/jaywcjlove/linux-command:latest .
207+
208+
# - name: Publish to GitHub registry
209+
# run: docker push ghcr.io/jaywcjlove/linux-command:latest
210+
211+
# - name: Tag docker image (beta) and publish to GitHub registry
212+
# if: steps.create_tag.outputs.successful
213+
# run: |
214+
# echo "version: v${{ steps.changelog.outputs.version }}"
215+
# docker tag ghcr.io/jaywcjlove/linux-command:latest ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}
216+
# docker push ghcr.io/jaywcjlove/linux-command:${{steps.changelog.outputs.version}}

0 commit comments

Comments
 (0)