mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-20 10:36:37 +08:00
ci: Use GitHub actions version 3, 4, and 5
- Switch from `v3` to `v4` of `git checkout` version. - Switch from `v2` to `v3` of `qemu setup` action version. - Switch from `v2` to `v3` of `docker buildx` setup. - Switch from `v2` to `v3` of `docker login` version. - Switch versions of multiple actions to their latest (`v5` for build and push) versions. - Main branch is changed from `main` to `master`.
This commit is contained in:
parent
d37fa80106
commit
50e0638313
48
.github/workflows/ci.yml
vendored
48
.github/workflows/ci.yml
vendored
@ -3,7 +3,7 @@ name: ci
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- 'master'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@ -11,55 +11,39 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
|
||||||
name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Login to Docker Hub
|
name: Login to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
# Get values for cache paths to be used in later steps
|
|
||||||
- id: go-cache-paths
|
|
||||||
run: |
|
|
||||||
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
||||||
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
||||||
|
|
||||||
# Cache go build cache, used to speedup go test
|
|
||||||
- name: Go Build Cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
||||||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
|
||||||
|
|
||||||
# Cache go mod cache, used to speedup builds
|
|
||||||
- name: Go Mod Cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
||||||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
||||||
|
|
||||||
- name: Add SHORT_SHA env property with commit short sha
|
- name: Add SHORT_SHA env property with commit short sha
|
||||||
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
|
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Build and push latest
|
name: Build and push latest
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ppcelery/one-api:latest
|
tags: ppcelery/one-api:latest
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
-
|
-
|
||||||
name: Build and push hash label
|
name: Build and push hash label
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ppcelery/one-api:${{ env.SHORT_SHA }}
|
tags: ppcelery/one-api:${{ env.SHORT_SHA }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
Loading…
Reference in New Issue
Block a user