|
| 1 | +# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context |
| 2 | +# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif |
| 3 | +name: CI |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - "v*" |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - next |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: cancel previous runs |
| 19 | + |
| 20 | + with: |
| 21 | + access_token: ${{ github.token }} |
| 22 | + |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: application build |
| 26 | + uses: php-actions/composer@v4 |
| 27 | + with: |
| 28 | + command: buildphar |
| 29 | + |
| 30 | + - name: create release |
| 31 | + id: create_release |
| 32 | + if: ${{ github.ref == v* }} |
| 33 | + uses: actions/create-release@v1 |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + with: |
| 37 | + tag_name: ${{ github.ref }} |
| 38 | + release_name: ${{ github.ref }} |
| 39 | + draft: false |
| 40 | + prerelease: false |
| 41 | + |
| 42 | + - name: upload release asset |
| 43 | + id: upload-release-asset |
| 44 | + if: ${{ github.ref == v* }} |
| 45 | + uses: actions/upload-release-asset@v1 |
| 46 | + env: |
| 47 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + with: |
| 49 | + # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 50 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 51 | + asset_path: ./releases/kubernetes-pfsense-controller-${{ github.ref }}.phar |
| 52 | + asset_name: kubernetes-pfsense-controller-${{ github.ref }}.phar |
| 53 | + asset_content_type: application/zip |
| 54 | + |
| 55 | + - name: docker build |
| 56 | + run: | |
| 57 | + export ARCH=$([ $(uname -m) = "x86_64" ] && echo "amd64" || echo "arm64") |
| 58 | + mkdir -p ~/.docker/cli-plugins/ |
| 59 | + wget -qO ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-${ARCH} |
| 60 | + chmod a+x ~/.docker/cli-plugins/docker-buildx |
| 61 | + docker info |
| 62 | + docker buildx version |
| 63 | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 64 | + docker buildx create --name xbuilder --use |
| 65 | + docker buildx inspect --bootstrap |
| 66 | + .github/bin/docker-release.sh |
| 67 | +
|
| 68 | + env: |
| 69 | + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} |
| 70 | + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
| 71 | + DOCKER_CLI_EXPERIMENTAL: enabled |
| 72 | + DOCKER_BUILD_PLATFORM: linux/amd64,linux/arm/v7,linux/arm64 |
0 commit comments