Merge pull request #8 from danni-cool/dev #13
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: Docker Build and Push | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
if: contains(github.event.head_commit.message, '[skip ci]') == false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: SetUp Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- name: Install devDependencies | |
run: npm install --only=dev | |
- name: Generate changelog and push changes | |
run: | | |
npm run release | |
git config --global user.email "[email protected]" | |
git config --global user.name "gitHubCi" | |
git add . | |
git commit -m "Commit changes for release" | |
git push origin main | |
- name: Get Package Version | |
id: get_version | |
run: echo "::set-output name=package_version::$(node -p "require('./package.json').version")" | |
- name: Create Github Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.get_version.outputs.package_version }} | |
release_name: Release v${{ steps.get_version.outputs.package_version }} | |
body: | | |
更新内容参见 [CHANGELOG](https://github.com/danni-cool/docker-wechatbot-webhook/blob/main/CHANGELOG.md) | |
draft: false | |
prerelease: false | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: dannicool | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push Docker Image | |
run: | | |
docker build . -t dannicool/docker-wechatbot-webhook:latest | |
docker push dannicool/docker-wechatbot-webhook:latest |