Update actions #136
Workflow file for this run
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - '*' | |
| pull_request: | |
| env: | |
| VERSION: dev | |
| AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| SOURCE_DIR: dist | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| os: [ linux,darwin,windows ] | |
| arch: [ amd64,arm64 ] | |
| exclude: | |
| - os: windows | |
| arch: arm64 | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: 1.25 | |
| - name: set version from tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: get the version from tag | |
| id: version | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
| - name: build | |
| run: make | |
| - name: test | |
| if: ${{ matrix.os == 'linux' && matrix.arch == 'amd64' }} | |
| run: make test | |
| - name: package | |
| run: make package | |
| - name: Upload production artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.os }}-${{ matrix.arch }} | |
| path: dist | |
| retention-days: 1 | |
| release-aws-dev: | |
| runs-on: ubuntu-latest | |
| needs: [build-test] | |
| if: startsWith(github.ref, 'refs/heads/') | |
| strategy: | |
| matrix: | |
| os: [ linux,darwin,windows ] | |
| arch: [ amd64,arm64 ] | |
| exclude: | |
| - os: windows | |
| arch: arm64 | |
| steps: | |
| - name: 'Download Artifact' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.os }}-${{ matrix.arch }} | |
| path: dist | |
| - name: release aws dev | |
| if: startsWith(github.ref, 'refs/heads/') | |
| uses: jakejarvis/s3-sync-action@master | |
| with: | |
| args: --acl public-read --follow-symlinks --delete | |
| env: | |
| DEST_DIR: wodby-cli/dev/${{ matrix.os }}/${{ matrix.arch }} | |
| release-aws-tagged: | |
| runs-on: ubuntu-latest | |
| needs: [build-test] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| strategy: | |
| matrix: | |
| os: [ linux,darwin,windows ] | |
| arch: [ amd64,arm64 ] | |
| exclude: | |
| - os: windows | |
| arch: arm64 | |
| steps: | |
| - name: set version from tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: 'Download Artifact' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.os }}-${{ matrix.arch }} | |
| path: dist | |
| - name: release aws latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: jakejarvis/s3-sync-action@master | |
| with: | |
| args: --acl public-read --follow-symlinks --delete | |
| env: | |
| DEST_DIR: wodby-cli/latest/${{ matrix.os }}/${{ matrix.arch }} | |
| - name: release aws tagged | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: jakejarvis/s3-sync-action@master | |
| with: | |
| args: --acl public-read --follow-symlinks --delete | |
| env: | |
| DEST_DIR: wodby-cli/$VERSION/${{ matrix.os }}/${{ matrix.arch }} | |
| create-gh-release: | |
| runs-on: ubuntu-latest | |
| needs: [build-test] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: get the version from tag | |
| id: version | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
| - name: Create Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.VERSION }} | |
| release_name: ${{ steps.version.outputs.VERSION }} | |
| draft: true | |
| prerelease: false | |
| upload-gh-release-artifacts: | |
| runs-on: ubuntu-latest | |
| needs: [create-gh-release] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| strategy: | |
| matrix: | |
| os: [ linux,darwin,windows ] | |
| arch: [ amd64,arm64 ] | |
| exclude: | |
| - os: windows | |
| arch: arm64 | |
| steps: | |
| - name: set version from tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: 'Download Artifact' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.os }}-${{ matrix.arch }} | |
| path: dist | |
| - name: release github | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: xresloader/upload-to-github-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| file: dist/wodby-*.tar.gz | |
| overwrite: true | |
| tags: true | |
| draft: false | |
| tag_name: ${{ env.VERSION }} | |
| build-test-release-image: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: docker/setup-qemu-action@v1 | |
| with: | |
| platforms: amd64,arm64 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: get the version from tag | |
| id: version | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
| - name: Build and push dev image | |
| uses: docker/build-push-action@v2 | |
| if: startsWith(github.ref, 'refs/heads/') | |
| with: | |
| context: . | |
| push: true | |
| build-args: VERSION=dev | |
| platforms: linux/amd64,linux/arm64 | |
| tags: wodby/wodby-cli:dev | |
| - name: Build and push tagged image | |
| uses: docker/build-push-action@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| context: . | |
| push: true | |
| build-args: VERSION=${{ steps.version.outputs.VERSION }} | |
| platforms: linux/amd64,linux/arm64 | |
| tags: wodby/wodby-cli:${{ steps.version.outputs.VERSION }},wodby/wodby-cli:latest |