Skip to content

Commit

Permalink
feat: test actions (#71)
Browse files Browse the repository at this point in the history
* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* feat: test actions

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

* fix: docker images

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>

---------

Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>
  • Loading branch information
cubxxw authored Jul 31, 2023
1 parent 7379e20 commit faca840
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 86 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v3
with:
Expand All @@ -51,6 +57,15 @@ jobs:
uses: docker/[email protected]
with:
images: openim/openim-chat
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Log in to Docker Hub
uses: docker/login-action@v2
Expand All @@ -62,6 +77,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down Expand Up @@ -107,6 +123,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta3.outputs.tags }}
labels: ${{ steps.meta3.outputs.labels }}
46 changes: 18 additions & 28 deletions .github/workflows/docker-buildx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ jobs:
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
# registry.cn-hangzhou.aliyuncs.com/${{github.repository_owner}}/${{env.IMAGE_NAME}}
# ghcr.io/${{github.repository_owner}}/${{env.IMAGE_NAME}}

images: |
openim/${{env.IMAGE_NAME}}
registry.cn-hangzhou.aliyuncs.com/${{github.repository_owner}}/${{env.IMAGE_NAME}}
ghcr.io/${{github.repository_owner}}/${{env.IMAGE_NAME}}
# generate Docker tags based on the following events/attributes
tags: |
Expand All @@ -73,33 +72,24 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to AliYun Docker Hub
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIREGISTRY_USERNAME }}
password: ${{ secrets.ALIREGISTRY_TOKEN }}

- name: Build and release Docker images
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
# platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }},latest
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}

# - name: Log in to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Log in to AliYun Docker Hub
# uses: docker/login-action@v2
# with:
# registry: registry.cn-hangzhou.aliyuncs.com
# username: ${{ secrets.ALIREGISTRY_USERNAME }}
# password: ${{ secrets.ALIREGISTRY_TOKEN }}

# - name: Build and release Docker images
# uses: docker/build-push-action@v4
# with:
# context: .
# platforms: linux/amd64,linux/arm64
# tags: ${{ steps.meta.outputs.tags }},latest
# push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' }}
40 changes: 38 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,43 @@ permissions:
jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags

- name: setup-snapcraft
# FIXME: the mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
- uses: actions/setup-go@v4
with:
go-version: stable

- name: set action env cache
uses: actions/cache@v3
with:
path: |
./_output/dist/*.deb
./_output/dist/*.rpm
./_output/dist/*.apk
key: ${{ github.ref }}

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected]
- uses: crazy-max/ghaction-upx@v2
with:
install-only: true
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.
- name: Set up QEMU
Expand All @@ -31,25 +60,32 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to AliYun Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIREGISTRY_USERNAME }}
password: ${{ secrets.ALIREGISTRY_TOKEN }}

# - name: snapcraft-login
# if: startsWith(github.ref, 'refs/tags/v')
# run: snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_TOKEN }}")

- uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: OpenIM Start Execute Scripts
name: OpenIM Chat Start Execute Scripts

on:
push:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/test_2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: ci2

on:
push:
branches:
- main
tags:
- v*
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
openim/openim-chat:latest
openim/openim-chat:1.0.0
ghcr.io/openimsdk/openim-chat:latest
ghcr.io/openimsdk/openim-chat:1.0.0
37 changes: 37 additions & 0 deletions .github/workflows/test_buildx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ci


on:
push:
branches:
- main
tags:
- v*
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: openim/openim-chat:latest
Loading

0 comments on commit faca840

Please sign in to comment.