docker image 0.1.4 #7
Workflow file for this run
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: ci-docker | |
# This workflow builds and pushes a Docker image to DockerHub, | |
# and tags the commit with the current version of the package. | |
# | |
# This workflow is triggered by: | |
# - a manual trigger | |
# This workflow should always be run against a git tag. | |
# - a release is published | |
# | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
docker-build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get version | |
id: get_version | |
run: | | |
case ${{ github.event_name }} in | |
workflow_dispatch) | |
version=${{ github.ref_name }} | |
;; | |
release) | |
version=${{ github.event.release.tag_name }} | |
;; | |
esac | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ vars.DOCKERHUB_USERNAME }}/shadowsocks-libev-v2ray:latest | |
${{ vars.DOCKERHUB_USERNAME }}/shadowsocks-libev-v2ray:${{ env.VERSION }} | |
platforms: linux/amd64,linux/arm64 | |
- name: Set up git user | |
run: | | |
git config --global user.name "ci-docker.github-actions[bot]" | |
git config --global user.email "ci-docker.github.actions[bot]@noreply.github.com" | |
- name: Tag commit | |
run: git tag -a -m "" "docker-${{ env.VERSION }}" | |
- name: Push tag | |
run: git push origin "refs/tags/docker-${{ env.VERSION }}" |