add actions
This commit is contained in:
parent
354ce72ac9
commit
66c7547061
3 changed files with 183 additions and 0 deletions
85
.github/workflows/pipeline-release.yml
vendored
Normal file
85
.github/workflows/pipeline-release.yml
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
name: Create Release
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.token }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
artifact:
|
||||
uses: h2-invent/jitsi-admin-matrix-bot/.github/workflows/task-artifact.yml@master
|
||||
|
||||
create_release:
|
||||
needs:
|
||||
- artifact
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
create_release_output: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: paulhatch/semantic-version@v5.0.2
|
||||
id: version
|
||||
with:
|
||||
tag_prefix: ""
|
||||
major_pattern: "(MAJOR)"
|
||||
minor_pattern: "(MINOR)"
|
||||
change_path: .
|
||||
version_format: "${major}.${minor}.${patch}"
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: artifact_${{github.run_number}}
|
||||
|
||||
- run: unzip -qq artifact_${{github.run_number}}.zip -d artifact
|
||||
|
||||
|
||||
|
||||
- name: Archive Release for application
|
||||
uses: thedoctor0/zip-release@0.7.1
|
||||
with:
|
||||
type: 'zip'
|
||||
filename: 'application.zip'
|
||||
exclusions: '*.git* *.github*'
|
||||
directory: artifact
|
||||
|
||||
- name: Archive Release for websocket
|
||||
uses: thedoctor0/zip-release@0.7.1
|
||||
with:
|
||||
type: 'zip'
|
||||
filename: 'websocket.zip'
|
||||
directory: artifact/nodejs
|
||||
|
||||
- name: Create new Release with semantic-version tag
|
||||
uses: ncipollo/release-action@v1
|
||||
id: create_release
|
||||
with:
|
||||
draft: false
|
||||
prerelease: false
|
||||
name: Release ${{ steps.version.outputs.version }}
|
||||
tag: ${{ steps.version.outputs.version }}
|
||||
artifacts: artifact/application.zip,artifact/nodejs/websocket.zip
|
||||
artifactContentType: application/zip
|
||||
bodyFile: RELEASE_NOTE.md
|
||||
|
||||
upload_dockerhub_main:
|
||||
needs:
|
||||
- create_release
|
||||
uses: h2-invent/jitsi-admin-matrix-bot/.github/workflows/task-upload-docker-hub.yml@master
|
||||
with:
|
||||
reponame: 'h2invent/jitsi-admin-matrix-bot'
|
||||
dockerfile_path: './Dockerfile'
|
||||
directory: '.'
|
||||
version: h2invent/jitsi-admin-matrix-bot:latest,h2invent/jitsi-admin-matrix-bot:${{ needs.create_release.outputs.create_release_output }}
|
||||
secrets:
|
||||
dockerhub_password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
|
28
.github/workflows/task-artifact.yml
vendored
Normal file
28
.github/workflows/task-artifact.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: Build Artifacts
|
||||
|
||||
on: workflow_call
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install NPM Packages
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ vars.NODE_VERSION }}
|
||||
|
||||
- name: Install Node modules
|
||||
run: npm install
|
||||
|
||||
|
||||
- uses: montudor/action-zip@v1
|
||||
with:
|
||||
args: zip -qq -r artifact_${{github.run_number}}.zip .
|
||||
|
||||
- name: Upload articats
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: artifact_${{github.run_number}}
|
||||
path: artifact_${{github.run_number}}.zip
|
70
.github/workflows/task-upload-docker-hub.yml
vendored
Normal file
70
.github/workflows/task-upload-docker-hub.yml
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# GitHub recommends pinning actions to a commit SHA.
|
||||
# To get a newer version, you will need to update the SHA.
|
||||
# You can also reference a tag or branch, but the action may change without warning.
|
||||
|
||||
name: Publish Docker image
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
reponame:
|
||||
description: 'the image name of the docker hub image'
|
||||
default: 'h2invent/jitsi-admin-main'
|
||||
required: true
|
||||
type: string
|
||||
directory:
|
||||
description: 'the dir of the Dockerfile image'
|
||||
default: '.'
|
||||
required: true
|
||||
type: string
|
||||
dockerfile_path:
|
||||
description: 'the name of the Dockerfile image'
|
||||
default: './Dockerfile'
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: 'the version/tag of the Dockerfile image'
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
dockerhub_username:
|
||||
required: true
|
||||
dockerhub_password:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get current Username
|
||||
id: date
|
||||
run: echo "${{ secrets.dockerhub_password }}"
|
||||
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||
with:
|
||||
username: ${{ secrets.dockerhub_username }}
|
||||
password: ${{ secrets.dockerhub_password }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
||||
with:
|
||||
images: ${{ inputs.reponame }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
|
||||
with:
|
||||
context: ${{ inputs.directory }}
|
||||
file: ${{ inputs.dockerfile_path }}
|
||||
push: true
|
||||
tags: ${{ inputs.reponame }}:${{ inputs.version }}
|
Loading…
Add table
Reference in a new issue